Joins in Rails

I may be missing something but have you tried:

Event.find(:all, :conditions => [ ... ], :include => :users)

I am unsure whether this would work with a has_many :through but it is worth a shot. At the very least you should be able to :include => :subscriptions and collect your users from that.

-Shawn

Ok, I see, looking at

:include gives a LEFT OUTER JOIN which you don't want, you should be able to use :join to do this, e.g.:

Event.find(:all, :conditions => [ ... ], join => "INNER JOIN subscriptions ON subscriptions.event_id = id")

There may be a nicer rails-ish way of doing this, but I am unaware of it.

-Shawn