aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2015-01-18 21:19:00 -0200
committerSantiago Pastorino <santiago@wyeworks.com>2015-01-18 21:19:00 -0200
commite3f5be1831c45dfadbb748d21b45d3167222300a (patch)
tree79a6db248d9362d5be895b2c396c68dd79b2e2b9 /activerecord/lib
parent9caeded9c62bf2c462a60a1a0b1a58249d4bd6ac (diff)
parent0fcd4cf5c26c470623eef9af72a134ef6ba1a701 (diff)
downloadrails-e3f5be1831c45dfadbb748d21b45d3167222300a.tar.gz
rails-e3f5be1831c45dfadbb748d21b45d3167222300a.tar.bz2
rails-e3f5be1831c45dfadbb748d21b45d3167222300a.zip
Merge pull request #18501 from prathamesh-sonpatki/nosql
Run SQL only if attribute changed for update_attribute method
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/persistence.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/persistence.rb b/activerecord/lib/active_record/persistence.rb
index 6306a25745..714d36e7c0 100644
--- a/activerecord/lib/active_record/persistence.rb
+++ b/activerecord/lib/active_record/persistence.rb
@@ -246,7 +246,7 @@ module ActiveRecord
name = name.to_s
verify_readonly_attribute(name)
send("#{name}=", value)
- save(validate: false)
+ save(validate: false) if changed?
end
# Updates the attributes of the model from the passed-in hash and saves the