Strange thing with find_by_sql in oracle

I did two sql queries in the same environment and at the same time: First: Message.find_by_sql(["select * from messages where id = ?", 1]) Returns:    gumentError: wrong number of arguments (0 for 1)       from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/ active_record    ase.rb:1750:in `y'       from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/ active_record    ase.rb:1750:in `compute_type'       from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/ active_record    ase.rb:1316:in `instantiate'       from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/ active_record    ase.rb:532:in `find_by_sql'       from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/ active_record    ase.rb:532:in `collect!'       from c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/ active_record    ase.rb:532:in `find_by_sql'       from (irb):11 Second:   Message.find_by_sql(["select * from messages where id = ?", 2])   Returns:      => In table messages, there is a message with id 1, but no message with id 2 also, I did this query with another table users, all worked well My environment:    ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]    Rails 2.0.2    database: oracle 10    table messages has more columns than table users ... Can anyone help me? Thanks!

Ok, i know what happened i have a column named "Type" and this makes everything happen can anyone tells me more details about this ?

“type” is a preserved keyword in ActiveRecord for implementing “Single table inheritance”, so don’t use it as a table column name.

See c:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:302 :

== Single table inheritance

Thanks!

Hi,

U may try this query

Message.find_by_sql(“select * from messages where id = ‘2’”).