Question

I am using

 @events = @user.events.where('finishDate >= ?', Time.now)

to retrieve the events from a certain user. Before displaying it I want to filter by date, and get rid off old one. Thus, finishDate column belong to Events. However it gives an error style "could not find 'finishDate' column in users_events table' (the table of the relationship)

How can I tell the query to look in events?

Était-ce utile?

La solution

For my surprise, the problem was not that the query was filtering in the wrong table. It was the name of the filtering column what was giving the error.

I renamed the table column from

finishDate

to

finish_date

and worked perfectly!

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top