开发者

Why can't I use order in find method?

开发者 https://www.devze.com 2023-01-22 16:22 出处:网络
In script/console Storage.find(:all , :conditions => \"item_id=1\" , order => \"expire_date DESC\")

In script/console

Storage.find(:all , :conditions => "item_id=1" , order => "expire_date DESC")

I get

NameError: undefined local variable or method `order' for #<Object:0xb7761954>
    from (开发者_运维问答irb):5

But it works when I use

Storage.find(:all , :conditions => "item_id=1")


order should be a symbol, :order => "expire_date DESC"

0

精彩评论

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