Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Problems with 'adopt' orphan strategy #114
Hello. I've met some problems when implementing "adopt" orphan strategy.
First, when just putting "gem 'ancestry'" to my gemfile i got an error saying that there is no such strategy, though the version of the gem was 1.3.0. I explored the source code and this strategy was actually there, so i had to put "gem 'ancestry', git: 'https://github.com/stefankroes/ancestry.git'" and it solved the problem.
But the main problem is related to ordering. I have an app with comments and replies. Comments are ordered by creation date (the newest are first). I use this construction: "arrange(:order => 'created_at DESC')" and do not have any "default_scope" in my model. Replies are showed just under the corresponding comment.
Everything is working fine until i begin to delete replies. For instance, i have:
-- Root comment
--- Reply to it (1)
---- Reply to reply (2)
So when i delete the root comment, the reply (1) becomes root (as far as i understood), reply (2) becomes its only child. But for some strange reason the ordering breaks and this group of comment and reply goes to the bottom of the list (right under the last comment). Other comments and replies has the corrent ordering, but after deleting some other root comment the corresponding branch goes to the end of the list too. This does not happen, if i delete reply (1) or reply (2) - only when i delete the root comment. I cannot manage to fix it.
Any clues about this issue?