diff options
author | Ernie Miller <ernie@metautonomo.us> | 2011-01-06 20:06:29 -0500 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2011-01-11 09:19:19 -0800 |
commit | 7d4d7457301faa85aa32b5ae29e13976e828954f (patch) | |
tree | 52695a0758fff2582736d08e672a3240b76b02f2 /activerecord/test/cases | |
parent | a60ea742226f09dc566ad5d9a0b465c5d5db9687 (diff) | |
download | rails-7d4d7457301faa85aa32b5ae29e13976e828954f.tar.gz rails-7d4d7457301faa85aa32b5ae29e13976e828954f.tar.bz2 rails-7d4d7457301faa85aa32b5ae29e13976e828954f.zip |
Fix polymorphic belongs_to associationproxy raising errors when loading target.
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/associations/belongs_to_associations_test.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/activerecord/test/cases/associations/belongs_to_associations_test.rb b/activerecord/test/cases/associations/belongs_to_associations_test.rb index 1cb29a0fa1..4c4891dcaf 100644 --- a/activerecord/test/cases/associations/belongs_to_associations_test.rb +++ b/activerecord/test/cases/associations/belongs_to_associations_test.rb @@ -146,6 +146,15 @@ class BelongsToAssociationsTest < ActiveRecord::TestCase assert_not_nil Company.find(3).firm_with_condition, "Microsoft should have a firm" end + def test_with_polymorphic_and_condition + sponsor = Sponsor.create + member = Member.create :name => "Bert" + sponsor.sponsorable = member + + assert_equal member, sponsor.sponsorable + assert_nil sponsor.sponsorable_with_conditions + end + def test_with_select assert_equal Company.find(2).firm_with_select.attributes.size, 1 assert_equal Company.find(2, :include => :firm_with_select ).firm_with_select.attributes.size, 1 |