Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Article about closure_tree #102

Closed
bodrovis opened this issue Jun 6, 2014 · 8 comments
Closed

Article about closure_tree #102

bodrovis opened this issue Jun 6, 2014 · 8 comments

Comments

@bodrovis
Copy link

bodrovis commented Jun 6, 2014

Hello!

Recently I've written an article for Sitepoint http://www.sitepoint.com/nested-comments-rails/ about closure_tree gem and, specifically, how to create nested comments system with it. You might want to give a link to it somewhere in the Readme. And thanks for this cool gem :)

@seuros
Copy link
Member

seuros commented Jun 6, 2014

README is not a place for such things.

btw you should rename your indexes and correct your comments

   add_index :comment_hierarchies, [:ancestor_id, :descendant_id, :generations],
              :unique => true, :name => "tag_anc_desc_udx"  #<< you have comments not tags

@bodrovis
Copy link
Author

bodrovis commented Jun 6, 2014

Cool, thanks!

@bodrovis bodrovis closed this as completed Jun 6, 2014
@mceachen
Copy link
Collaborator

mceachen commented Jun 6, 2014

I just read your article—it was very straightforward and ready to follow,
nice work!

I'll add a link to your article. I think it might help others use this gem.

@mceachen
Copy link
Collaborator

mceachen commented Jun 6, 2014

@bodrovis the biggest issue with ancestry isn't the project activity—it's that he's using a "materialized path". He's using a concatenated set of IDs in a string for tree management.

This approach is fine when you only have several hundred records, and your query can do table scans. It breaks down at higher scale, though.

The other approach is using a "nested set"—but that requires every tree update to touch half of the other rows in your tree table (worst case).

I think it might be interesting to add a benchmark in your article contrasting the performance of the three approaches.

@bodrovis
Copy link
Author

bodrovis commented Jun 6, 2014

@mceachen Oh, okay, I will try do some research :)

@seuros
Copy link
Member

seuros commented Jun 6, 2014

@bodrovis : https://github.com/mceachen/closure_tree/wiki look at the last link.

@mceachen
Copy link
Collaborator

mceachen commented Jun 8, 2014

@bodrovis I added the link in the FAQ section. Thanks again for writing that tutorial!

@bodrovis
Copy link
Author

bodrovis commented Jun 8, 2014

The pleasure was all mine :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants