aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/base.rb
diff options
context:
space:
mode:
authorFranck Verrot <franck@verrot.fr>2011-01-25 23:36:08 +0100
committerSantiago Pastorino <santiago@wyeworks.com>2011-02-02 12:45:25 -0200
commit8dcacd0cc7fe634ed0bedbc21dfbb0da46298686 (patch)
tree3d1c1de977830ea5615e4d7f6833b688b531ec89 /activerecord/lib/active_record/base.rb
parenta5b03e9c7af8f539764a66f9bd51b7ebbcb9f57d (diff)
downloadrails-8dcacd0cc7fe634ed0bedbc21dfbb0da46298686.tar.gz
rails-8dcacd0cc7fe634ed0bedbc21dfbb0da46298686.tar.bz2
rails-8dcacd0cc7fe634ed0bedbc21dfbb0da46298686.zip
Refactor clear_timestamp_attributes to use the newly created all_timestamp_attributes_in_model
Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
Diffstat (limited to 'activerecord/lib/active_record/base.rb')
-rw-r--r--activerecord/lib/active_record/base.rb8
1 files changed, 3 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index 04b479bdb2..c592490c84 100644
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -1898,11 +1898,9 @@ MSG
# Clear attributes and changed_attributes
def clear_timestamp_attributes
- %w(created_at created_on updated_at updated_on).each do |attribute_name|
- if has_attribute?(attribute_name)
- self[attribute_name] = nil
- changed_attributes.delete(attribute_name)
- end
+ all_timestamp_attributes_in_model.each do |attribute_name|
+ self[attribute_name] = nil
+ changed_attributes.delete(attribute_name)
end
end
end