aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations/has_many_associations_test.rb
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2011-05-10 22:47:54 +0100
committerJon Leighton <j@jonathanleighton.com>2011-05-10 22:54:40 +0100
commit9a7dbe2c0570e11b9033df735c937d5f5416e0ca (patch)
tree3adf27844a83699f7f3c062fc6bc59762f7fb14e /activerecord/test/cases/associations/has_many_associations_test.rb
parent8f999a3f80284e08804c374cb5690c8bc158e4c1 (diff)
downloadrails-9a7dbe2c0570e11b9033df735c937d5f5416e0ca.tar.gz
rails-9a7dbe2c0570e11b9033df735c937d5f5416e0ca.tar.bz2
rails-9a7dbe2c0570e11b9033df735c937d5f5416e0ca.zip
Don't use mass-assignment protection when applying the scoped.scope_for_create. Fixes #481.
Diffstat (limited to 'activerecord/test/cases/associations/has_many_associations_test.rb')
-rw-r--r--activerecord/test/cases/associations/has_many_associations_test.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/has_many_associations_test.rb b/activerecord/test/cases/associations/has_many_associations_test.rb
index dc2481456b..5a414c49f1 100644
--- a/activerecord/test/cases/associations/has_many_associations_test.rb
+++ b/activerecord/test/cases/associations/has_many_associations_test.rb
@@ -86,11 +86,20 @@ class HasManyAssociationsTest < ActiveRecord::TestCase
bulb = car.bulbs.new
assert_equal car.id, bulb.car_id
+ bulb = car.bulbs.new :car_id => car.id + 1
+ assert_equal car.id, bulb.car_id
+
bulb = car.bulbs.build
assert_equal car.id, bulb.car_id
+ bulb = car.bulbs.build :car_id => car.id + 1
+ assert_equal car.id, bulb.car_id
+
bulb = car.bulbs.create
assert_equal car.id, bulb.car_id
+
+ bulb = car.bulbs.create :car_id => car.id + 1
+ assert_equal car.id, bulb.car_id
ensure
Bulb.attr_protected :id
end