1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Use the method for determining attribute methods rather than duplicating

I've been trying to reduce the number of places that care about
`attributes`, and its existence. We have a method for this check, let's
use it instead.
This commit is contained in:
Sean Griffin 2014-08-14 12:43:57 -06:00
parent 4751a8c51f
commit a3ee03083b

View file

@ -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