ruby on rails - Equivilent to where() on a Associations::CollectionProxy -
how go having condition in association? since it's returning collectionproxy there's barely information, in docs, it. can't figure out do, why wouldn't work?
@new_notifications = self.notifications.where({:seen => false})
figured out! reason, passing hash statement problem. works:
@notifs = self.notifications.where(seen = false)
collectproxy
subclass of relation
means can expect.
so, like:
self.notifications.where(:seen => false)
would work provided have has_many :notifications
association on whatever self
is.
Comments
Post a Comment