diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-01-04 13:25:33 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-01-04 13:25:33 -0800 |
commit | 07c192a705001252e563735788c29fe7a90d5447 (patch) | |
tree | 7fd5569cc1959d8a4df0dd9b7ed5b19fc7f2a697 /activemodel | |
parent | fd2d78dbc89a5875fb6e70416b991b371ea33468 (diff) | |
download | rails-07c192a705001252e563735788c29fe7a90d5447.tar.gz rails-07c192a705001252e563735788c29fe7a90d5447.tar.bz2 rails-07c192a705001252e563735788c29fe7a90d5447.zip |
push exception message formatting to the exception class
Diffstat (limited to 'activemodel')
-rw-r--r-- | activemodel/lib/active_model/mass_assignment_security/sanitizer.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/activemodel/lib/active_model/mass_assignment_security/sanitizer.rb b/activemodel/lib/active_model/mass_assignment_security/sanitizer.rb index 33259b98bd..ab96e7937f 100644 --- a/activemodel/lib/active_model/mass_assignment_security/sanitizer.rb +++ b/activemodel/lib/active_model/mass_assignment_security/sanitizer.rb @@ -46,7 +46,7 @@ module ActiveModel def process_removed_attributes(attrs) return if (attrs - insensitive_attributes).empty? - raise ActiveModel::MassAssignmentSecurity::Error, "Can't mass-assign protected attributes: #{attrs.join(', ')}" + raise ActiveModel::MassAssignmentSecurity::Error.new(attrs) end def insensitive_attributes @@ -55,6 +55,9 @@ module ActiveModel end class Error < StandardError + def initialize(attrs) + super("Can't mass-assign protected attributes: #{attrs.join(', ')}") + end end end end |