Hi there!
I've followed the tutorial at Railscasts.com and the one in Advanced Rails Recipes (that doesn't worked, so now I have a hybrid solution) and all works fine except when I try to use a checkbox in the child model partial. When I do this, the parameters hash are broken, like this:
Parameters hash without the checkbox (or when unchecked):
{"commit"=>"Update",
"_method"=>"put",
(...),
"existing_time_entry_attributes"=>
[{"task_id"=>"1",
"description"=>"new description",
"temporary"=>"0",
"id"=>"22",
"should_destroy"=>""},
{"task_id"=>"1",
"description"=>"tests",
"temporary"=>"0",
"id"=>"23",
"should_destroy"=>""}], "worker_id"=>"1"}}
Now with the checkbox checked (the attribute is called "temporary", a boolean):
{"commit"=>"Update",
"_method"=>"put",
(...),
"existing_time_entry_attributes"=>
[{,
"task_id"=>"1",
"description"=>"pix 2.0",
"temporary"=>"1"},
{"should_destroy"=>"",
"task_id"=>"1",
"id"=>"22",
"temporary"=>"0",
"description"=>"tests"},
{"should_destroy"=>"",
"id"=>"23",
"temporary"=>"0"}], "worker_id"=>"1"}}
As you can see, I have two registers and try to update the first one by checking the checkbox. The "existing_time_entry_attributes" array should have two positions, but is passed with three. the "brake" is right there on the boolean attribute. Anyone knows a solution?