diff options
author | Matthew Draper <matthew@trebex.net> | 2014-05-03 16:19:24 +0930 |
---|---|---|
committer | Matthew Draper <matthew@trebex.net> | 2014-05-03 16:29:40 +0930 |
commit | 022c797926591ed62d63f403ef314f2461b506ea (patch) | |
tree | 3e044af4274a7fc22f1e2950c5af198661dfc384 /activerecord/test/cases/associations | |
parent | 193eb6252f0b2f0031acdb3157d4bb2efc0447c6 (diff) | |
parent | c6d685ba1118cc1f6303122117df945ebe8fceae (diff) | |
download | rails-022c797926591ed62d63f403ef314f2461b506ea.tar.gz rails-022c797926591ed62d63f403ef314f2461b506ea.tar.bz2 rails-022c797926591ed62d63f403ef314f2461b506ea.zip |
Merge pull request #14924 from eric-chahin/issue_13854
Fixed custom validation context bug for child associations
Diffstat (limited to 'activerecord/test/cases/associations')
-rw-r--r-- | activerecord/test/cases/associations/has_many_associations_test.rb | 10 |
1 files changed, 10 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 151edfc6a1..d748e80695 100644 --- a/activerecord/test/cases/associations/has_many_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_associations_test.rb @@ -26,6 +26,8 @@ require 'models/reference' require 'models/job' require 'models/college' require 'models/student' +require 'models/pirate' +require 'models/ship' class HasManyAssociationsTestForReorderWithJoinDependency < ActiveRecord::TestCase fixtures :authors, :posts, :comments @@ -1883,4 +1885,12 @@ class HasManyAssociationsTest < ActiveRecord::TestCase end end end + + test 'has_many_association passes context validation to validate children' do + pirate = FamousPirate.new + pirate.famous_ships << ship = FamousShip.new + assert_equal true, pirate.valid? + assert_equal false, pirate.valid?(:conference) + assert_equal "can't be blank", ship.errors[:name].first + end end |