Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何在没有任何条件的情况下获取模型的 ActiveRecord::Relation 对象?因为我可以写
User.where # without any args
,但这看起来令人困惑
User.scoped会做的。where像, order,等所有方法limit都委托给scoped. 直接调用它会给你裸露的Relation.
User.scoped
where
order
limit
scoped
Relation