I’m using a gem that doesnt work on the arrays from the find_all_by() method, but does with the .where(); however, I don’t know how to write it in a way that produces the same result.
For instance, how could I rewrite:
Post.find_all_by_poster(@user.id , :conditions => ['title IS NOT NULL OR name !=?', 'Bob' ])
My attempt:
Post.where("poster = ? AND title !=? OR name !=?", @user.id, 'NULL', 'Bob')
Any ideas? I’m having trouble satisfying the same conditions. Thanks for your help!
You still need to use
IS NOT NULLinstead of passing inNULLas a separate parameter: