From 8dcacd0cc7fe634ed0bedbc21dfbb0da46298686 Mon Sep 17 00:00:00 2001 From: Franck Verrot Date: Tue, 25 Jan 2011 23:36:08 +0100 Subject: Refactor clear_timestamp_attributes to use the newly created all_timestamp_attributes_in_model Signed-off-by: Santiago Pastorino --- activerecord/lib/active_record/base.rb | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'activerecord') 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 -- cgit v1.2.3