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

doesn't work with rails default_scope #56

Open
spovich opened this issue Dec 14, 2009 · 5 comments
Open

doesn't work with rails default_scope #56

spovich opened this issue Dec 14, 2009 · 5 comments

Comments

@spovich
Copy link

spovich commented Dec 14, 2009

Bug or just fundamental incompatibility w/rails default_scope? If I declare a default_scope on my model, none of the rails_helpers for click-sort column headings will work.

The search object is built up correctly, but rails clobbers it w/the default scope.

I can work around this by declaring default sort criteria in the controller where the search object is created, but the only thing I don't like is how the the default_scope silently kills your searchlogic search.

Any thoughts?

@etaque
Copy link

etaque commented Jan 12, 2010

same bug and same workaround for me.

@tilsammans
Copy link

i created a failing spec for this bug here:
http://github.com/tilsammans/searchlogic/commit/c7be7da17300796b5a93f5173c9539afd0f8ae4f

and plan on attacking the bug itself next. can't quite wrap my mind around it yet though.

@etaque
Copy link

etaque commented Feb 3, 2010

By the way, :order on a default scope can't be overriden by the :order of a named_scope, and Searchlogic is based on named_scopes. So, that's probably an ActiveRecord bug/feature.

@tilsammans
Copy link

Where did you get that idea? The outermost named_scope clobbers any default scope.

Fixed this in my fork: commit http://github.com/tilsammans/searchlogic/commit/c03a3bfd35dae543d3c3a3e258c187e7edd2ad3d

will send a pull request to binarylogic

@etaque
Copy link

etaque commented Feb 3, 2010

From this ticket:
https://rails.lighthouseapp.com/projects/8994/tickets/2346-named_scope-doesnt-override-default_scopes-order-key

But I may be misleading 'cause I don't know ActiveRecord plumbing enough for the moment. Hope your patch will resolve it.

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