开发者

unscope only the order statements

开发者 https://www.devze.com 2023-02-19 08:47 出处:网络
How can i unscope all the ORDER BY sql statemnts in rails 3? cha开发者_高级运维in.unscoped.order(\"id ASC\")

How can i unscope all the ORDER BY sql statemnts in rails 3?

cha开发者_高级运维in.unscoped.order("id ASC")

problem that i have is that this will also drop the WHERE statements and my query is meaningless without them. something like .unscoped('order') would be nice.


You can use the except() method.

chain.except(:order)

I think that'll do what you want.

0

精彩评论

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