我有以下找不到的发现
self.participants.where(:role => "Celebrant", :created_at => year..Time.now, :board_id => !current_board.id)
我想找到满足上述要求的参与者
:board_id not equal to current_board.id
如何使用rails 3在哪里?
答案 0 :(得分:8)
你想要这样的东西:
self.participants.
where(:role => "Celebrant", :created_at => year..Time.now).
where('board_id <> ?', current_board.id)
您必须将“不等于”的字符串条件和SQL片段下拉为Hash conditions are a bit limited:
只有使用哈希条件才能进行相等,范围和子集检查。