You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#search ignores :order argument on associations which have an order defined
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.
Consider a class Foo, with associated Bars:
@@@ ruby
class Foo < ActiveRecord::Base
has_many :bars, :order => :name
end
@@@
If you do:
@@@ ruby
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:
@@@ sql
SELECT * FROM bars WHERE bars.foo_id = 1 ORDER BY bars.name;
@@@
Is this a bug?
original LH ticket
This ticket has 0 attachment(s).
The text was updated successfully, but these errors were encountered: