I have this connection:
has_many :foo_participators, through: :foos, source: :user, conditions: "foos.state = 'completed'"
Rails tells me:
DEPARTMENT WARNING: The following parameters are in your Bar.has_many: The declaration foo_participators is deprecated :: conditions. Please use the scope block instead. For example, the following:has_many :spam_comments, conditions: { spam: true }, class_name: 'Comment' should be rewritten as follows:has_many :spam_comments, -> { where spam: true }, class_name: 'Comment'
DEPARTMENT WARNING: The following parameters are in your Bar.has_many: The declaration foo_participators is deprecated :: conditions. Please use the scope block instead. For example, the following:
has_many :spam_comments, conditions: { spam: true }, class_name: 'Comment'
should be rewritten as follows:
has_many :spam_comments, -> { where spam: true }, class_name: 'Comment'
Is this possible with my association?
I found out right after I asked the question. For some reason, I have not tried putting lambda first - it works fine.
has_many :foo_participators, ->{where "foos.state = 'completed'"}, through: :foos, source: :user