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.
我正在尝试为我的项目中的所有模型添加一个“default_scope”:
default_scope where(:deleted => false)
有没有办法自动为所有模型添加这个 default_scope ?
也许使用模块?
嗯,我能想到的最接近的是从同一类派生模型,这个范围适用。