From 95454bfb33a9b29703dbbf04d1a71d06a68ae787 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 23 Jan 2005 17:24:54 +0000 Subject: Added mass-assignment protection for the inheritance column -- regardless of a custom column is used or not git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@477 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/test/base_test.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'activerecord/test') diff --git a/activerecord/test/base_test.rb b/activerecord/test/base_test.rb index da9daa6398..c5a6b7d656 100755 --- a/activerecord/test/base_test.rb +++ b/activerecord/test/base_test.rb @@ -383,6 +383,13 @@ class BasicsTest < Test::Unit::TestCase assert_equal 1, firm.rating end + def test_mass_assignment_protection_on_defaults + firm = Firm.new + firm.attributes = { "id" => 5, "type" => "Client" } + assert_nil firm.id + assert_equal "Firm", firm[:type] + end + def test_mass_assignment_accessible reply = Reply.new("title" => "hello", "content" => "world", "approved" => 0) reply.save -- cgit v1.2.3