diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2008-09-08 09:45:26 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2008-09-08 09:45:26 -0700 |
commit | 4f6875296f6e6ea123130582923284bfd24cd7f1 (patch) | |
tree | a9a2964bf08f5958165f45faac245ed1001ff0f9 /activerecord/test/cases/base_test.rb | |
parent | 7e6cda15f8dae517f9605f73aa1c966a29d4930a (diff) | |
download | rails-4f6875296f6e6ea123130582923284bfd24cd7f1.tar.gz rails-4f6875296f6e6ea123130582923284bfd24cd7f1.tar.bz2 rails-4f6875296f6e6ea123130582923284bfd24cd7f1.zip |
Revert "Revert "Raise UnknownAttributeError when unknown attributes are supplied via mass assignment""
This reverts commit 41efd73887c00ffd228b05d9346ec47a1f3759b9.
Diffstat (limited to 'activerecord/test/cases/base_test.rb')
-rw-r--r-- | activerecord/test/cases/base_test.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/activerecord/test/cases/base_test.rb b/activerecord/test/cases/base_test.rb index 0038174ad8..67358fedd6 100644 --- a/activerecord/test/cases/base_test.rb +++ b/activerecord/test/cases/base_test.rb @@ -904,6 +904,14 @@ class BasicsTest < ActiveRecord::TestCase assert_nil keyboard.id end + def test_mass_assigning_invalid_attribute + firm = Firm.new + + assert_raises(ActiveRecord::UnknownAttributeError) do + firm.attributes = { "id" => 5, "type" => "Client", "i_dont_even_exist" => 20 } + end + end + def test_mass_assignment_protection_on_defaults firm = Firm.new firm.attributes = { "id" => 5, "type" => "Client" } |