Answer the question
In order to leave comments, you need to log in
What is the correct way to organize a tree structure in Rails4?
Hi all!
I started learning ruby on rails recently, so I'm stating my question in the light of what I've learned. Task from one vacancy:
You need to create a blog.
There are 3 models Comment, Post, Category. Comment and Post organized simply through post_id. Somewhere I read information that an excessive hierarchy destroys the speed of a request, and now it does not leave me alone for a day. Is it worth it to add a category_id to the Post model (more precisely, to the migration file) and continue working, or is there a gem and possibly another implementation? According to the conditions and Category should be organized in a tree structure (it's not entirely clear to me how they do it). Enlighten who can. Thank you!
Answer the question
In order to leave comments, you need to log in
You should at least fully voice the task, and not your guesses, but in general you are here - rusrails.ru/active-record-associations
And even better here:
https://www.railstutorial.org/book
railstutorial.ru
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question