diff options
author | Jon Leighton <j@jonathanleighton.com> | 2011-12-14 17:25:51 +0000 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2011-12-14 17:28:59 +0000 |
commit | 909b337da8d905afe0204cd96b033a276522441f (patch) | |
tree | b4ec853a6112cf2e0bf3135f7a274f170bc04c9a /activerecord/test/cases | |
parent | 18bf30982bb2ec013dc65a7e7e65ff45fcd4d73b (diff) | |
download | rails-909b337da8d905afe0204cd96b033a276522441f.tar.gz rails-909b337da8d905afe0204cd96b033a276522441f.tar.bz2 rails-909b337da8d905afe0204cd96b033a276522441f.zip |
Don't try to autosave nested assocs. Fixes #2961.
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/associations/nested_through_associations_test.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/nested_through_associations_test.rb b/activerecord/test/cases/associations/nested_through_associations_test.rb index 530f5212a2..1af92fd025 100644 --- a/activerecord/test/cases/associations/nested_through_associations_test.rb +++ b/activerecord/test/cases/associations/nested_through_associations_test.rb @@ -545,6 +545,20 @@ class NestedThroughAssociationsTest < ActiveRecord::TestCase assert_equal [organizations(:nsa)], organizations end + def test_nested_has_many_through_should_not_be_autosaved + welcome_general, thinking_general = taggings(:welcome_general), taggings(:thinking_general) + + assert_equal [welcome_general, thinking_general], + categorizations(:david_welcome_general).post_taggings.order('taggings.id') + + c = Categorization.new + c.author = authors(:david) + c.post_taggings.to_a + assert !c.post_taggings.empty? + c.save + assert !c.post_taggings.empty? + end + private def assert_includes_and_joins_equal(query, expected, association) |