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?

Was it helpful?

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!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top