我有一个模型叫site
.
site has_many site_settings
site_settings belongs_to setting
setting
有一个名为的布尔字段temporary
我希望和之间的关系site
只site_settings
返回site_settings
与临时无关的setting
.
我试过了:
class Site < ActiveRecord::Base
has_many :site_settings, :dependent => :destroy,
:conditions => {:setting => {:temporary => false} }
我也尝试过一些事情Proc.new
,但没有成功。
有什么帮助吗?