So I'd like to be able to sort first by an attribute, and then amongst those with the same attribute value, sort randomly.
As in:
{ :sort_mode => :extended, :order => "attribute DESC, @random ASC" }
In my case the attribute is boolean, so I just want the ones that are true
to all display before the ones that are false
, but for the order within each of the true
and false
buckets to be random.
For some reason, this does not return any results. If I modify the above, and change @random to @relevance, it works:
{ :sort_mode => :extended, :order => "attribute DESC, @relevance ASC" }
Is there something wrong with using @random to sort along with other attributes? If so, is there a different solution to my problem??
Thanks!!