hi, I want to update the database given a where clause. Basically i want a function like ActiveRecord::base.update_attributes along with a parameter for condition.
http://www.railsbrain.com/api/rails-1.2.6/doc/index.html?a=M001518&name=update_attributes
Currently as far as i can tell only update_all has a where clause but it does not respect callbacks or validations. I can enclose the update_attributes statement in a if clause, but then it is possible that i have loaded a stale object. Also is it possible to get the update_count and not the updated object.
eg : if obj.status == 'P' obj.update_attributes(:status => 'D', :amount => 100) end