Using hashes as find conditions

I've been having problems using hashes in conjunction with SQL. Here's an example:

   Question.count(:all, :conditions => { :parent => nil })

And here's the query it runs :

   SELECT count(*) AS count_all FROM questions WHERE (parent)

If I try to do something like:

   Question.count(:all, :conditions => { :parent => 1 })

I get:

   Mysql::Error: #42S22Unknown column 'parent1' in 'where clause': SELECT count(*) AS count_all FROM questions WHERE (parent1)

Why does it strip out the conditional text?

I'm running Rails 1.2.3

Thanks in advance for any help!

Saxon

using hashed conditions only works in 1.2.x i believe.

1.1.6 behavior

{ :parent => nil } # => select * from ... where (parent) { :parent => 1 } # => select * from ... where (parent1)

1.2.3 behavior

{ :parent => nil } # => select * from ... where (parent IS NULL) { :parent => 1 } # => select * from ... where (parent = 1)

sorry, missed that you said you were using 1.2.3.

did you create your project using a previous version of rails? if so, check your config/environment.rb file. that will specify which version your project is using.

Well don't I feel silly. I did in fact create the application using 1.1.6, so I updated the number in the environment.rb file and it works just fine. Thank you for your help!

Saxon