I have a Person model which has attributes name and address.I am doing this:
ActiveRecord::Base.transaction do
Person.where(:id=>[1]).update_all(:address => "Newyork") #1st update
Person.where(:id=>[2]).update_all(:address1 => "Newyork") #2nd update
end
I intentionally put address1
here which is not the property/attribute of model Person. As address1
is not the property of this model so 2nd update
should get failed and 1st update
should get rollbacked too.
But in my case, 2nd update
is getting failed but 1st update
is not rolling back.Why?