aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillermo Iguaran <guilleiguaran@gmail.com>2012-08-13 00:41:04 -0500
committerGuillermo Iguaran <guilleiguaran@gmail.com>2012-09-16 23:58:21 -0500
commit1fa4f9243d09b3872a110c1057a828a753822728 (patch)
tree9915b652a1bb4ec6bc72b40e44d10c2d1653009a
parent4b608c009e155d79532a00b97ac0ec524d7ad849 (diff)
downloadrails-1fa4f9243d09b3872a110c1057a828a753822728.tar.gz
rails-1fa4f9243d09b3872a110c1057a828a753822728.tar.bz2
rails-1fa4f9243d09b3872a110c1057a828a753822728.zip
Rename ForbiddenAttributes exception to ForbiddenAttributesError
-rw-r--r--activemodel/lib/active_model/forbidden_attributes_protection.rb4
-rw-r--r--activemodel/test/cases/forbidden_attributes_protection_test.rb2
-rw-r--r--activerecord/lib/active_record/attribute_assignment.rb2
-rw-r--r--activerecord/test/cases/forbidden_attributes_protection_test.rb2
4 files changed, 5 insertions, 5 deletions
diff --git a/activemodel/lib/active_model/forbidden_attributes_protection.rb b/activemodel/lib/active_model/forbidden_attributes_protection.rb
index 29bc47f151..a5e4c4f650 100644
--- a/activemodel/lib/active_model/forbidden_attributes_protection.rb
+++ b/activemodel/lib/active_model/forbidden_attributes_protection.rb
@@ -1,11 +1,11 @@
module ActiveModel
- class ForbiddenAttributes < StandardError
+ class ForbiddenAttributesError < StandardError
end
module ForbiddenAttributesProtection
def sanitize_for_mass_assignment(attributes, options = {})
if attributes.respond_to?(:permitted?) && !attributes.permitted?
- raise ActiveModel::ForbiddenAttributes
+ raise ActiveModel::ForbiddenAttributesError
else
attributes
end
diff --git a/activemodel/test/cases/forbidden_attributes_protection_test.rb b/activemodel/test/cases/forbidden_attributes_protection_test.rb
index fab28ced0e..f6437333b0 100644
--- a/activemodel/test/cases/forbidden_attributes_protection_test.rb
+++ b/activemodel/test/cases/forbidden_attributes_protection_test.rb
@@ -20,7 +20,7 @@ end
class ActiveModelMassUpdateProtectionTest < ActiveSupport::TestCase
test "forbidden attributes cannot be used for mass updating" do
params = ProtectedParams.new({ "a" => "b" })
- assert_raises(ActiveModel::ForbiddenAttributes) do
+ assert_raises(ActiveModel::ForbiddenAttributesError) do
Account.new.sanitize_for_mass_assignment(params)
end
end
diff --git a/activerecord/lib/active_record/attribute_assignment.rb b/activerecord/lib/active_record/attribute_assignment.rb
index 9e45a83fcf..c30443f7a8 100644
--- a/activerecord/lib/active_record/attribute_assignment.rb
+++ b/activerecord/lib/active_record/attribute_assignment.rb
@@ -7,7 +7,7 @@ module ActiveRecord
# matching the attribute names (which again matches the column names).
#
# If the passed hash responds to permitted? method and the return value
- # of this method is false an ActiveModel::ForbiddenAttributes exception
+ # of this method is false an ActiveModel::ForbiddenAttributesError exception
# is raised.
def attributes=(new_attributes)
return unless new_attributes.is_a?(Hash)
diff --git a/activerecord/test/cases/forbidden_attributes_protection_test.rb b/activerecord/test/cases/forbidden_attributes_protection_test.rb
index cf462297ef..89e9de261a 100644
--- a/activerecord/test/cases/forbidden_attributes_protection_test.rb
+++ b/activerecord/test/cases/forbidden_attributes_protection_test.rb
@@ -26,7 +26,7 @@ end
class ForbiddenAttributesProtectionTest < ActiveRecord::TestCase
def test_forbidden_attributes_cannot_be_used_for_mass_assignment
params = ProtectedParams.new(first_name: 'Guille', gender: 'm')
- assert_raises(ActiveModel::ForbiddenAttributes) do
+ assert_raises(ActiveModel::ForbiddenAttributesError) do
Person.new(params)
end
end