Where clause with Association
TIL that you can use a where clause when defining model associations
class Foo < ActiveRecord::Base
has_many :bars, -> {where(active: true)}
end
Tweet
TIL that you can use a where clause when defining model associations
class Foo < ActiveRecord::Base
has_many :bars, -> {where(active: true)}
end
Tweet