nil in ActiveRecord and SQL

In SQL, you need "something IS NULL" rather than "something = NULL". The above code should have raised a StatementInvalid exception saying as much.

Pass conditions as a hash to have Active Record choose whether to use IS NULL for you:   SomethingClass.find(:all, :conditions => { :something_attribute => nil })

Or use the find_all_by_* shorthand:   SomethingClass.find_all_by_something_attribute(nil)

jeremy

Check out the ez_where plugin if you'd like to easily translate Ruby's operators to SQL.

jeremy