aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/timestamp.rb
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2014-08-14 12:11:44 +0200
committerYves Senn <yves.senn@gmail.com>2014-08-14 12:11:44 +0200
commit76b587880ed411cd7d4168954ffa673eadcb1073 (patch)
tree922ec203a3c9179bfe3a30293aefff0850d55898 /activerecord/lib/active_record/timestamp.rb
parent76ea9f9714ff08cfffec16fc3672480a9f46f5d9 (diff)
parentb892d20c610af78a94ba6c9488092ef76845242a (diff)
downloadrails-76b587880ed411cd7d4168954ffa673eadcb1073.tar.gz
rails-76b587880ed411cd7d4168954ffa673eadcb1073.tar.bz2
rails-76b587880ed411cd7d4168954ffa673eadcb1073.zip
Merge pull request #8813 from greyblake/dont_write_timestamps_if_they_are_not_attributes
Write timestamps only if there are timestamps columns Conflicts: activerecord/CHANGELOG.md
Diffstat (limited to 'activerecord/lib/active_record/timestamp.rb')
-rw-r--r--activerecord/lib/active_record/timestamp.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/timestamp.rb b/activerecord/lib/active_record/timestamp.rb
index ddf3e1804c..5ef98ed820 100644
--- a/activerecord/lib/active_record/timestamp.rb
+++ b/activerecord/lib/active_record/timestamp.rb
@@ -47,7 +47,7 @@ module ActiveRecord
current_time = current_time_from_proper_timezone
all_timestamp_attributes.each do |column|
- if respond_to?(column) && respond_to?("#{column}=") && self.send(column).nil?
+ if attributes.key?(column.to_s) && self.send(column).nil?
write_attribute(column.to_s, current_time)
end
end