I want to create a check box that will update a field in a database table. How do you link a method in a model to a check box? -- 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 -~----------~----~----~----~------~----~------~--~---
Sc Pu wrote:> I want to create a check box that will update a field in a database > table. How do you link a method in a model to a check box?check_box object, method :) steve -- 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 -~----------~----~----~----~------~----~------~--~---
Sc Pu wrote:> I want to create a check box that will update a field in a database > table. How do you link a method in a model to a check box? > >Do you mean updates the record via Ajax when the check box is clicked? See http://www.ruby-forum.com/topic/112174 -- ---------------------------- http://autopendium.com Stuff about old cars --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Steve Rawlinson wrote:> > check_box object, method >I tried that in a form, and it didn''t work, is there any way to force it to do execute the method. Chris Taggart wrote:> >Do you mean updates the record via Ajax when the check box is clicked? >See http://www.ruby-forum.com/topic/112174 >Also, I like the idea of automatically updating with ajax, is there a way to do this without UJS? -- 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 -~----------~----~----~----~------~----~------~--~---
Scott Pn wrote:> Steve Rawlinson wrote: > >> check_box object, method >> >> > > I tried that in a form, and it didn''t work, is there any way to force it > to do execute the method. > > Chris Taggart wrote: > >> Do you mean updates the record via Ajax when the check box is clicked? >> See http://www.ruby-forum.com/topic/112174 >> >> > > Also, I like the idea of automatically updating with ajax, is there a > way to do this without UJS? > > >Yes, you can use the observer_field helper method (http://api.rubyonrails.org/classes/ActionView/Helpers/PrototypeHelper.html#M000535) Hope this helps Chris -- ---------------------------- Autopendium :: Stuff about old cars http://autopendium.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 -~----------~----~----~----~------~----~------~--~---