Rails has_many :through Find by Extra Attributes in Join Model

How about adding something like this into your User model?

has_many  :active_events, :through => :event_users, 
          :class_name => "Event", 
          :source => :event, 
          :conditions => ['event_users.active = ?',true]

After that you should be able to get active events for a user just by calling:

User.first.active_events

Leave a Comment