Topic: Order through association
I have current_user which has_many: events
An event has_many :event_dates
Currently I can do current_user.events
Which shows me all the events I have been Invited through, via the Invitation model.
Now, on the dashboard I only want to get Events.where the event_dates 'date' is today or in the future.
I've tried doing..
@events = current_user.events.where('events.event_dates.date >= ?, Date.today')
I'm just now sure if I'm on the right track or miles off!
Any help would be much appreciated!