【发布时间】:2015-03-26 12:03:05
【问题描述】:
我搜索了很多但没有找到有意义的东西,关于为什么我们在查询中使用“->”:
如关联:
has_many :comments, -> { order('posted_at DESC') }
在范围内:
scope :active, -> { where state: 'active' }
提前致谢
【问题讨论】:
标签: ruby-on-rails scope associations model-associations named-scope