aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/associations_test.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2006-09-01 05:31:56 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2006-09-01 05:31:56 +0000
commitb1257d96b7b2482fc7811e5dc12d71c9fa091d10 (patch)
tree244c5033c18cf4de0745f5d01def696accd618bc /activerecord/test/associations_test.rb
parent9c99be88b2806600f768b74bcfff1bc93de8c5ef (diff)
downloadrails-b1257d96b7b2482fc7811e5dc12d71c9fa091d10.tar.gz
rails-b1257d96b7b2482fc7811e5dc12d71c9fa091d10.tar.bz2
rails-b1257d96b7b2482fc7811e5dc12d71c9fa091d10.zip
has_many :through conditions are sanitized by the associating class. Closes #5971.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4893 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/test/associations_test.rb')
-rwxr-xr-xactiverecord/test/associations_test.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/test/associations_test.rb b/activerecord/test/associations_test.rb
index 100b30f126..ede0e399c0 100755
--- a/activerecord/test/associations_test.rb
+++ b/activerecord/test/associations_test.rb
@@ -410,6 +410,10 @@ class HasManyAssociationsTest < Test::Unit::TestCase
assert_equal "Microsoft", Firm.find(:first).clients_like_ms.first.name
end
+ def test_finding_with_condition_hash
+ assert_equal "Microsoft", Firm.find(:first).clients_like_ms_with_hash_conditions.first.name
+ end
+
def test_finding_using_sql
firm = Firm.find(:first)
first_client = firm.clients_using_sql.first
@@ -1546,8 +1550,10 @@ class HasAndBelongsToManyAssociationsTest < Test::Unit::TestCase
def test_associations_with_conditions
assert_equal 3, projects(:active_record).developers.size
assert_equal 1, projects(:active_record).developers_named_david.size
+ assert_equal 1, projects(:active_record).developers_named_david_with_hash_conditions.size
assert_equal developers(:david), projects(:active_record).developers_named_david.find(developers(:david).id)
+ assert_equal developers(:david), projects(:active_record).developers_named_david_with_hash_conditions.find(developers(:david).id)
assert_equal developers(:david), projects(:active_record).salaried_developers.find(developers(:david).id)
projects(:active_record).developers_named_david.clear