Hello, I don''t understand why Mouvement.update_all(''etat = false'', :conditions => ["id_paire = ?", params[:id_paire]]) generates these SQL statements UPDATE mouvements SET etat = false WHERE (conditionsid_paire = ?1f194375-f715-4493-bf21-9269aafc7cff) I presume I could write Mouvement.update_all(''etat = false'', "id_paire = ''#{params[:id_paire]}''") But I don''t understandt why ! The first solution seems more coherent with the way we express conditions with the find_XXX methods... Any idea ? Thanks -- 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 -~----------~----~----~----~------~----~------~--~---
nuno wrote:> > Mouvement.update_all(''etat = false'', :conditions => ["id_paire = ?", > params[:id_paire]]) > > generates these SQL statements > > UPDATE mouvements SET etat = false WHERE (conditionsid_paire = > ?1f194375-f715-4493-bf21-9269aafc7cff) > > I presume I could write > Mouvement.update_all(''etat = false'', "id_paire = > ''#{params[:id_paire]}''") > > But I don''t understandt why ! The first solution seems more coherent > with the way we express conditions with the find_XXX methods... >Any thoughts ?? -- 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 -~----------~----~----~----~------~----~------~--~---
You''re using update_all incorrectly, the second parameter should not be a hash... See http://api.rubyonrails.com/classes/ActiveRecord/Base.html#M000867 In your case you should change your code to: Mouvement.update_all(''etat = false'', ["id_paire = ?", params[:id_paire]]) nuno wrote:> Hello, I don''t understand why > > Mouvement.update_all(''etat = false'', :conditions => ["id_paire = ?", > params[:id_paire]]) > > generates these SQL statements > > UPDATE mouvements SET etat = false WHERE (conditionsid_paire > ?1f194375-f715-4493-bf21-9269aafc7cff) > > I presume I could write > Mouvement.update_all(''etat = false'', "id_paire > ''#{params[:id_paire]}''") > > But I don''t understandt why ! The first solution seems more coherent > with the way we express conditions with the find_XXX methods... > > > > Any idea ? > > Thanks > > -- > 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 -~----------~----~----~----~------~----~------~--~---
eden li wrote:> You''re using update_all incorrectly, the second parameter should not be > a hash... See > http://api.rubyonrails.com/classes/ActiveRecord/Base.html#M000867 > > In your case you should change your code to: > Mouvement.update_all(''etat = false'', ["id_paire = ?", > params[:id_paire]])Thank you works fine ! -- 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 -~----------~----~----~----~------~----~------~--~---