Sqlite3 activerecord :order => “time DESC” doesn't sort

女生的网名这么多〃 提交于 2019-12-01 06:21:46
newtover

It is usually a bad idea to use reserved words without surrounding quotes. time is a built-in function in SQLite, try using the following instead and better get rid of the ambiguity in the first place:

Production.find(:all,
                :conditions => ["`time` > ?", start_time.utc],
                :order => "`time` DESC",
                :limit => 100)

UPD: The problem seems to have appeared on SO:

Rails Active Record find(:all, :order => ) issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!