Conditions on Has_many :Through


You should do something like this:

first of all I'd suggest you remove MY from model's name (so instead of MySchedules to be only Schedule).

In Schedule model (schedule.rb) you have to make a finder:

def self.between(from, to)   self.find :all, :conditions => ["happens_on BETWEEN ? AND ?", from, to] end

Then you can do find like this:

person = Person.find 1 person.schedules.between(@from, @to)

Hope this helps.

you can use a named scope for that