喜んでこのように使用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
コードの最初の行の逆を把握または見つけることができません。私はそれが簡単であるべきだと思います:)