首页 > 代码库 > default_scope 排序的使用

default_scope 排序的使用

在以前的版本使用default_scope:default_scope :order => ‘title‘ 现在使用rails4的时候报错,

参考(hellolucky‘s blog)http://blog.hellolucky.info/articles/ruby-on-rails-rails4-learning-experience-finishing-rails-4-zombie-outlaws-1/

现在是这么用的default_scope {order (:title)}

本文出自 “骑猴上树” 博客,请务必保留此出处http://qihoushangshu.blog.51cto.com/7872138/1549865

default_scope 排序的使用