I''ve tried this (in a new method/template -- so @type doesn''t actually exist yet): check_box ''type'', ''notify_on_create'', {:checked=>''true''} But :checked seems to get swallowed. I''ve also tried setting notify_on_create to true in the Type model, but that doesn''t work either. Any way to get the check_box to default to checked? Thanks, Joe -- 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 -~----------~----~----~----~------~----~------~--~---
Hi Joe: The check_box helper doesn''t work with :checked => true. Since it is tailored to work with a specific object and method, the value returned by that method determines whether or not the checkbox is checked. If the value is an integer above zero, then the checkbox will be checked. The check_box_tag helper does accept ":checked => true", but does not tie itself directly to an object/method like check_box does. check_box http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html#M000394 check_box_tag http://api.rubyonrails.org/classes/ActionView/Helpers/FormTagHelper.html#M000500 c. Joe Ruby MUDCRAP-CE wrote:> I''ve tried this (in a new method/template -- so @type doesn''t actually > exist yet): > > check_box ''type'', ''notify_on_create'', {:checked=>''true''} > > But :checked seems to get swallowed. I''ve also tried setting > notify_on_create to true in the Type model, but that doesn''t work > either. Any way to get the check_box to default to checked? > > Thanks, > Joe-- 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 -~----------~----~----~----~------~----~------~--~---
On Sun, Oct 15, 2006, Joe Ruby MUDCRAP-CE wrote:> I''ve tried this (in a new method/template -- so @type doesn''t actually > exist yet): > > check_box ''type'', ''notify_on_create'', {:checked=>''true''} > > But :checked seems to get swallowed. I''ve also tried setting > notify_on_create to true in the Type model, but that doesn''t work > either. Any way to get the check_box to default to checked?Like someone else said, check_box doesn''t care about that. It''ll use whatever value is in @type.notify_on_create... I think you see where I''m going with this... <% @type.notify_on_create = true -%> <%= check_box ''type'', ''notify_on_create'' %> I haven''t tested that, but it''ll probably work. ;) Ben --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---