Reputation: 223
I have model Car. I set to @cars.update_attributes params as hash(params = {"id"=>"60", "attr_1"=>"137.0", "attr_2"=>"11414.0", "attr_3"=>"6004"}) And after I see in log -
(0.8ms) UPDATE "cars" SET "attr_3" = 6004.0, "updated_at" = '2015-02-27 18:51:52.583925' WHERE "cars"."id" = 60
Only field attr_3 was updated. attr_1 and attr_2 have old values and so even not try update. How I can see attrs which will be updated before "send" commands to DB?
Upvotes: 0
Views: 33
Reputation: 19879
You want the methods provided by ActiveModel::Dirty.
http://api.rubyonrails.org/classes/ActiveModel/Dirty.html
@cars.changes
for example.
Upvotes: 4