aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations/has_many_through_associations_test.rb
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2011-01-26 23:00:13 +0000
committerJon Leighton <j@jonathanleighton.com>2011-01-30 11:58:09 +0000
commit3fa61ccb9eed0f17cdef85470ae708b4b09a3c06 (patch)
tree7f750e467a122891d248cbc0badb9ce485a37a51 /activerecord/test/cases/associations/has_many_through_associations_test.rb
parentc5e912a8b38bc3555385e43a052a8d3eb0541ff3 (diff)
downloadrails-3fa61ccb9eed0f17cdef85470ae708b4b09a3c06.tar.gz
rails-3fa61ccb9eed0f17cdef85470ae708b4b09a3c06.tar.bz2
rails-3fa61ccb9eed0f17cdef85470ae708b4b09a3c06.zip
Has many through - It is not necessary to manually merge in the conditions hash for the through record, because the creation is done directly on the through association, which will already handle setting the conditions.
Diffstat (limited to 'activerecord/test/cases/associations/has_many_through_associations_test.rb')
-rw-r--r--activerecord/test/cases/associations/has_many_through_associations_test.rb12
1 files changed, 11 insertions, 1 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 7235631b5a..96f4597726 100644
--- a/activerecord/test/cases/associations/has_many_through_associations_test.rb
+++ b/activerecord/test/cases/associations/has_many_through_associations_test.rb
@@ -20,10 +20,13 @@ require 'models/subscription'
require 'models/categorization'
require 'models/category'
require 'models/essay'
+require 'models/member'
+require 'models/membership'
+require 'models/club'
class HasManyThroughAssociationsTest < ActiveRecord::TestCase
fixtures :posts, :readers, :people, :comments, :authors, :categories,
- :owners, :pets, :toys, :jobs, :references, :companies,
+ :owners, :pets, :toys, :jobs, :references, :companies, :members,
:subscribers, :books, :subscriptions, :developers, :categorizations
# Dummies to force column loads so query counts are clean.
@@ -557,4 +560,11 @@ class HasManyThroughAssociationsTest < ActiveRecord::TestCase
assert proxy.stale_target?
assert_equal authors(:david).categorizations.sort_by(&:id), post.author_categorizations.sort_by(&:id)
end
+
+ def test_create_with_conditions_hash_on_through_association
+ member = members(:groucho)
+ club = member.clubs.create!
+
+ assert_equal true, club.reload.membership.favourite
+ end
end