diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-09-17 06:40:38 -0700 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-09-17 06:40:38 -0700 |
commit | 82d507b4c37ff3a770a0c90424d73e967328094c (patch) | |
tree | 9545d89c2fab6b8806021cef6e7dc67dda14db7d /activerecord/test | |
parent | 896594f5ae4f11a33be98858b2e359ab1931786c (diff) | |
parent | 610b63288f05bdec677bfd78c546ee085e5184b9 (diff) | |
download | rails-82d507b4c37ff3a770a0c90424d73e967328094c.tar.gz rails-82d507b4c37ff3a770a0c90424d73e967328094c.tar.bz2 rails-82d507b4c37ff3a770a0c90424d73e967328094c.zip |
Merge pull request #7661 from ernie/build-join-records-on-unsaved-hmt
Fix collection= on hm:t join models when unsaved
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/associations/has_many_through_associations_test.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/has_many_through_associations_test.rb b/activerecord/test/cases/associations/has_many_through_associations_test.rb index 36e5ba9660..c591fd8532 100644 --- a/activerecord/test/cases/associations/has_many_through_associations_test.rb +++ b/activerecord/test/cases/associations/has_many_through_associations_test.rb @@ -838,6 +838,11 @@ class HasManyThroughAssociationsTest < ActiveRecord::TestCase end end + def test_assign_array_to_new_record_builds_join_records + c = Category.new(:name => 'Fishing', :authors => [Author.first]) + assert_equal 1, c.categorizations.size + end + def test_create_bang_should_raise_exception_when_join_record_has_errors repair_validations(Categorization) do Categorization.validate { |r| r.errors[:base] << 'Invalid Categorization' } |