我已經連接了兩個查詢結果並希望根據特定條件限制結果。Rails級聯查詢結果「其中」
def all_notifications
return (user_project_notifications+followed_comments).sort_by(&:created_at).reverse
end
我想通過限制那些all_notifications一定時間後到來,所以像:
def new_notifications(notifications_last_viewed)
return all_notifications.where('created_at >?, notifications_last_viewed)
end
但是,我得到Array的錯誤未定義的方法',其中」 :...
如何在連接結果上執行「where」查詢?
好的,我明白了。現在要弄清楚如何從activerecord查詢獲得followed_comments ... – scientiffic