I don't suppose it's as simple as not calling the check_box helper from the form object you're getting out of fields_for is it? I would guess that's what would happen if you did...
-----Original Message----- From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Danimal Sent: Thursday, October 09, 2008 7:30 PM To: Ruby on Rails: Talk Subject: [Rails] ajax complex forms: checkbox weirdness Hello! Question for you wizards... If you've used Ryan Bates tutorial on complex forms: http://railscasts.com/episodes/75 ... or better yet, the one from Advanced Rails Recipes... perhaps you can help me. I set up a complex form for an Account that has many Formats which works nearly the same as the ARR example of Project has_many Tasks. One thing that is breaking, though, is the use of checkboxes in the Formats partial. The problem is that when I add a partial, Rails puts the hidden checkbox with value "0" in there... but this then gets passed in as another attribute set, so my virtual attribute methods bomb. For example, if I have a Format that has: Name (string), Description (text) and Active (boolean), then when I submit the form, I should get: params[:account][:new_format_attribute] = [{:name => "foo", :description => "bar", :active => "1"}] Instead, I get: params[:account][:new_format_attribute] = [{:name => "foo", :description => "bar", :active => "1"}, {:active => "0"}] You see? It's adding the hidden value of active in as a separate attribute hash. Any ideas on how to skip this? Or should I just skip the Rails checkbox helper and code my own? Thanks for any tips! -Danimal --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

