Updating just one property of an ActiveRecord

Duane Morin wrote:

All I want to do is change one field of my object and update it in the
database. I thought that this was the syntax:

    obj.update_attribute(:status_id, 5)

but the SQL statement that's generated it still attempting to specify
values for every single field in the object. This causes me problems
(one of the fields is a very long XML object) so I'm trying to avoid it.
What's the Ruby syntax that will generate just the single statement to
update object_table set status_id=5 where id=xxx?


I think Model.update_all will do what you want. You can get the exact
syntax from Rails doc.