
#search ignores :order argument on associations which have an order defined
Reported by Mark Dodwell | July 28th, 2009 @ 07:01 PM
Consider a class Foo, with associated Bars:
class Foo < ActiveRecord::Base
has_many :bars, :order => :name
end
If you do:
Foo.bars.search(:order => "ascend_by_size").all
The results are still sorted by :name -- i.e. the "ascend_by_size" :order argument to the #search method is ignored.
The SQL query looks like:
SELECT * FROM bars WHERE bars.foo_id = 1 ORDER BY bars.name;
--
Is this a bug?
Comments and changes to this ticket
-
Ben Johnson July 30th, 2009 @ 02:47 AM
- State changed from new to open
Hmm, I'm not sure, let me add a failing test and play around with it. If you want fork the project and write a quick failing test. It looks like the Searchlogic::Search#current_scope is taking priority.
-
Ben Johnson August 7th, 2009 @ 06:30 PM
- State changed from open to moved_to_github
[state:"moved_to_github" bulk edit command]
-
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
Provides common named scopes and object based searching.