On May 24, 6:29 pm, Freddy Andersen <[email protected]> wrote:
> if params[:checkbox]
>
> This checks if that params is true(true/false, 1/0)
both 1 and 0 are true in ruby :-)
If you are doing this by hand you will need to compare params
[:checkbox] to the value that gets submitted. if you are using the
check_box helper then by default the value will be "0" or
"1" (strings, not integers). If you are using check_box_tag or
crafting the html by hand then it is slightly more troublesome as if
the check box is not ticked there will be no value in the params hash.
If you are using the check_box helper it might be appropriate to just
pass the appropriate part of the params hash to update_attributes.
Fred
or not, but how
> did you do you checkbox code? If its just a form_for .. do |f|
> f.checkbox(:checkbox) you should be ok.
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---