0
我想从以下(简化)表结果的排序列表:复杂的Rails订购
create_table "evaluations", :force => true do |t|
t.datetime "completed_at"
t.datetime "created_at", :null => false
end
我想completed_at
(DESC)命令,如果completed_at
设置(NOT NULL)。如果completed_at
为空,我想要订购created_at
(DESC)。
有没有一种方法可以通过模型与Rails 3做到这一点?
我使用的SQLite我的本地机器,但皮克在服务器上(我会切换到很快就两个页码。)