I'm hoping there is a easy solution that doesn't involve find_by_sql
, if not then I guess that will have to work.
I found this article which references this:
Topic.find(:all, :conditions => { :forum_id => @forums.map(&:id) })
which is the same as
SELECT * FROM topics WHERE forum_id IN (<@forum ids>)
I am wondering if there is a way to do NOT IN
with that, like:
SELECT * FROM topics WHERE forum_id NOT IN (<@forum ids>)
Best Answer
Rails 4+:
Rails 3:
Where
actions
is an array with:[1,2,3,4,5]