on-internet
← Community

Equivilent to where() on a Associations::CollectionProxy

Stack Overflow ·

How would you go about having a where condition in an association? Since it's returning a CollectionProxy which there's barely any information, even in the DOCS, about it. I can't figure out what to do, why wouldn't something like this work? @new_notifications = self.notifications.where({:seen => false}) Figured it out! For some reason, passing a hash into the where statement was the problem. This works: @notifs = self.notifications.where(:seen = false)

Comments

Sign in or sign up to comment and upvote.

No comments yet.