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 ? Mickael. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 19 Jul 2008, at 18:49, Mickael Faivre-Macon wrote:> > 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. Fred --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
thanks again Fred ! Frederick Cheung wrote:> 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. > > Fred-- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---