From 81c12d1f6359eb5e52b376f1f3552097a144cc8b Mon Sep 17 00:00:00 2001 From: Trevor Turk Date: Mon, 11 Aug 2008 21:17:14 -0500 Subject: move logging of protected attribute removal into log_protected_attribute_removal method Signed-off-by: Michael Koziarski [#804 status:committed] --- activerecord/lib/active_record/base.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'activerecord') diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 29c2995334..e5b6e3a02f 100644 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -2594,7 +2594,7 @@ module ActiveRecord #:nodoc: removed_attributes = attributes.keys - safe_attributes.keys if removed_attributes.any? - logger.debug "WARNING: Can't mass-assign these protected attributes: #{removed_attributes.join(', ')}" + log_protected_attribute_removal(removed_attributes) end safe_attributes @@ -2609,6 +2609,10 @@ module ActiveRecord #:nodoc: end end + def log_protected_attribute_removal(*attributes) + logger.debug "WARNING: Can't mass-assign these protected attributes: #{attributes.join(', ')}" + end + # The primary key and inheritance column can never be set by mass-assignment for security reasons. def attributes_protected_by_default default = [ self.class.primary_key, self.class.inheritance_column ] -- cgit v1.2.3