开发者

Rails :order, can I order by 2 things at the same time, one before the other?

so I want to do something like this:

, :order => "(products.name = 'Some Product' or products.name) desc", :order=>'distance'

has anyon开发者_JAVA百科e done this before? I realize that I cant do it the way I have written, but hope it explains the order I want the orders to happen.


Yes, you can.

:order => "column1 ASC, column2 DESC"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜