Aa is an empty class, subclassing ActiveRecord::Base. It has one column called 'nothing'
a = Aa.new
=> #<Aa:0xb723dacc @new_record=true, @attributes={"nothing"=>nil}>
a.save
=> true
Aa.find(:first, :conditions => 'id is null')
=> #<Aa:0xb7237050 @attributes={"id"=>"3", "nothing"=>nil}>
Aa.find(:first, :conditions => 'id is null')
=> nil
note the two find calls are identical, but the first call returns an unexpected result.
the log says:
SQL (0.000243) BEGIN
SQL (0.000226) INSERT INTO aas (nothing) VALUES(NULL)
SQL (0.003979) COMMIT
Aa Load (0.001234) SELECT * FROM aas WHERE (id is null) LIMIT 1
Aa Load (0.000842) SELECT * FROM aas WHERE (id is null) LIMIT 1
version info:
rails 1.1.6
mysql Ver 14.12 Distrib 5.0.26, for pc-linux-gnu (i686) using readline 5.1
mysql 2.7 gem
Gentoo Linux