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

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -