@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
添加到此代码?
答案 0 :(得分:0)
只需追加它:)
@past_topics = ... # your code
@past_topics = @past_topics.where('events.date < ?', DateTime.now)