MasonLogan
Joined
Activity
Hi, I am completely new to Rails and would like some help. I am trying to implement a to-do list using Rails as my backend and React as my frontend. Initially, I created a model and controller that would allow me to create/update/delete tasks. Now I would like to classify them into their categories. The first thing I did was to create a another model Category that has_many tasks and then the Task model belongs_to category.
Now, previously everything was submitted as JSON to the Tasks controller which then created the task. However, now that I've created the relations between Task and Category, how do I go about submitting my form data? The form data will contain only description (task description) and category. Should I send the data to Categories controller? If yes, then how do I let the controller know to create a new category in the categories database if the category doesn't exist. After which, how do I create the task in the tasks database and assign it the category_id?
I've tried searching online for help but everything was about creating the relations which I've already done. But I just have no idea how to create the new tasks in the controllers.
I am a programmer with almost two years of experience writing software in mostly Go and Python (backend). I need to learn rails in about 3 weeks time before starting my new internship at hackerrank (most of their backend is RoR) https://scrabblewordfinder.vip/
I have written some projects in Ruby but I have never tried out Rails before. I am looking for Resources that might be suitable for someone like me who is not a complete beginner in programming to get comfortable with Rails quickly. https://www.applock.ooo/
If you could suggest a learning path too (pick this up, then do this...) or https://www.7zip.vip/any advice you would give to someone starting Rails that would be appreciated too.