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.
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.
if obj.status == 'P'
obj.update_attributes(:status => 'D', :amount => 100)