0

我在用

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

从特定用户检索事件。在显示它之前,我想按日期过滤,并摆脱旧的。因此,finishDate 列属于事件。但是它给出了错误样式“在 users_events 表中找不到'finishDate'列”(关系表)

如何告诉查询查看事件?

4

1 回答 1

1

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!

于 2012-04-17T07:38:27.990 回答