method "first" of a model

I can 't explain this:

Loading development environment (Rails 2.1.0)

t = Task.first("id=?",2032)

=> #<Task id: 95, project_id: 9, user_id: 7, ........>

Can you ?


find (and thus the first method) ignores arguments that are not part of an option hash, so

t = Task.first("id=?",2032) is the same as t = Task.first
Task.first :conditions => ["id=?",2032]
does what you want.


thanks again Fred !

Frederick Cheung wrote: