aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorYves Senn <yves.senn@gmail.com>2014-08-15 14:09:48 +0200
committerYves Senn <yves.senn@gmail.com>2014-08-15 14:09:48 +0200
commitc595a4f69f4b60441537b31b5d029efc6c9d6e61 (patch)
tree6970ed4fd25c70d42d6395c64a353381dc5ee380 /activerecord
parent4954de65a62941126a7aa194aa83275c0e98d486 (diff)
parenta3ee03083b50e1458c1276f499226ec59c0fb73d (diff)
downloadrails-c595a4f69f4b60441537b31b5d029efc6c9d6e61.tar.gz
rails-c595a4f69f4b60441537b31b5d029efc6c9d6e61.tar.bz2
rails-c595a4f69f4b60441537b31b5d029efc6c9d6e61.zip
Merge pull request #16505 from sgrif/sg-attribute-internals
Use the method for determining attribute methods rather than duplicating
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/timestamp.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/timestamp.rb b/activerecord/lib/active_record/timestamp.rb
index 5ef98ed820..417cd61f0c 100644
--- a/activerecord/lib/active_record/timestamp.rb
+++ b/activerecord/lib/active_record/timestamp.rb
@@ -47,8 +47,9 @@ module ActiveRecord
current_time = current_time_from_proper_timezone
all_timestamp_attributes.each do |column|
- if attributes.key?(column.to_s) && self.send(column).nil?
- write_attribute(column.to_s, current_time)
+ column = column.to_s
+ if has_attribute?(column) && !attribute_present?(column)
+ write_attribute(column, current_time)
end
end
end