Вопрос

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?

Это было полезно?

Решение

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!

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top