愉快地使用Mongoid
并ActiveRecord
喜欢这样:
Task.where(project_id: params[:project_id], archived_at: nil)
# find me the tasks for project_id that haven't been archived
但是说相反的直接方式是什么?
# find me the tasks for project_id that have been archived
# i.e. where archived_at is not nil
无法弄清楚或找出第一行代码的倒数。我认为它应该很简单:)