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:
parent
4751a8c51f
commit
a3ee03083b
1 changed files with 3 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue