0
@past_topics = Topic.includes(:user, :event).where("event_id IS NOT NULL "cached_votes_up DESC").page(params[:page]).per(6)

那是我的代码。

如何event.date < DateTime.now在条件下添加到此代码where

4

1 回答 1

0

只需附加它:)

@past_topics = ... # your code
@past_topics = @past_topics.where('events.date < ?', DateTime.now)
于 2013-02-07T08:56:44.517 回答