Ask A Question

Notifications

You’re not receiving notifications from this thread.

How do I create hierarchical data with a model?

Félix Landry-Audet asked in General

I have found and played with awesome_nested_set which is awesome for real. I was wondering if this is the recommended gem for managing tree data in Rails or if there are any others that would do it. awesome_nested_set is really doing the job however I find it lacks of documentation.

Thanks! :)

Félix

Reply

There are a handful of different ways you can do it. This is actually a nice little blog post talking about 3 options and their pros / cons. Generally you're going to want ones with fast reads because that's going to be the more common query.

https://www.leighhalliday.com/tree-structures-in-your-rails-models

Reply

Yep thanks I read that. I was confident using awesome-nested_set but just found out closure_tree which seems to have more documentation and more options. I'll try it out.

Thanks!

Reply

Oh wonderful, I haven't heard of that one and by the docs and activity it certainly looks like it's well maintained. I'll have to try it out!

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 87,110+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.