update/update_attribute questions

Ok. But in Mongrel I see this:

Parameters: {"commit"=>"Save changes", "action"=>"update_entries",
"e"=>{"34"=>{"visible"=>"true"}, "35"=>{"visible"=>"false"},
"36"=>{"visible"=>"false"}, "37"=>{"visible"=>"false"},
"38"=>{"visible"=>"false"}, "39"=>{"visible"=>"false"}},

and then this one for each entry (even those I didn't change):

This is intentional: you get one parameter for every checkbox, even if you didn't change that check box (there's some behind the scenes stuff with a hidden field), which brings it inline with all the other input types. If you use check_box_tag you won't get this

Entry Load (0.001275) SELECT * FROM entries WHERE (entries."id" = 34)
Entry Update (0.040439) UPDATE entries SET "visible" = 't',
"content" = 'test text', "title" = 'test title', "entry_date" =
'2007-10-15' WHERE "id" = 34

So, I think that update is updating ALL the rows, and all the cols, not
only the rows/cols I've just changed. That's not a good thing for me.
How can I fix this?

Either use check_box_tag, or maybe use a hidden field 'previous value' so that your controller knows which parameters to ignore

I thought at least that update_attribute would write all the rows but
only in the 'visible' column, but it seems it does exactly the same
things of update, instead.

I really don't understand why. Anyone can help me? :slight_smile:

That's the just the way it is right now (for better or for worse).