I have a Place model and an Event model. Places can have events that take place on a specific date.
How can I set up my associatio
To solve the dynamic date problem, have you considered:
class Event < ActiveRecord::Base
belongs_to :place
scope :on_date, lambda {|the_date| where(start_date: the_date) }
scope :on_or_after, lambda {|the_date| where('start_date >= ?', the_date) }
end
You could then do this:
@place = Place.find(params[:id]) # let's say...
@place.events.on_date(params[:chosen_date])
You can incorporate the eager loading stuff that others have mentioned too.