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

Add a caveat about default_scope to the README? #86

Closed
bithive opened this issue Jan 21, 2014 · 5 comments
Closed

Add a caveat about default_scope to the README? #86

bithive opened this issue Jan 21, 2014 · 5 comments

Comments

@bithive
Copy link

bithive commented Jan 21, 2014

I just spent way too long trying to figure out why closure_tree wasn't working for me; it turns out that I had declared

default_scope { order('id asc') }

in my model and it was causing trees to misbehave when they contained children whose IDs where less than that of their parent. Perhaps my blunder can be documented to help others avoid similar headaches.

@mceachen
Copy link
Collaborator

Bummer! I'll add a warning to the README.

@geordee
Copy link

geordee commented Sep 28, 2014

Is it just the "order" in the default_scope? How about if I define a default_scope with a "where"?

@jmuheim
Copy link

jmuheim commented Dec 8, 2015

I've come here from the README. But I don't really get the point: what exactly is the problem? I'm in the process of choosing a gem for creating trees, and I'd like to choose closure_tree, but first I'd like to know what the caveat is with this issue.

Thanks for explaining a bit deeper.

@mceachen
Copy link
Collaborator

mceachen commented Dec 8, 2015 via email

@kaoru
Copy link

kaoru commented Nov 26, 2018

I suspect this is the problem I'm having too. I've got a default scope thanks to the paranoia gem, and even though none of the records I'm trying to add to a hierarchy it seems like the whole thing isn't working properly with the scope set 😢

I wonder if this could be made to work by having an option to has_closure_tree that would make it always use #unscoped.

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

5 participants