diff options
author | Ruy Asan <ruyasan@gmail.com> | 2009-05-01 13:09:29 -0700 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2009-05-01 14:47:56 -0700 |
commit | 99c103be1165da9c8299bc0977188ecf167e06a5 (patch) | |
tree | f57524e693656e67f09173f130dbc174b298daf6 /activerecord/test/cases | |
parent | db0bfe4ede3cdfc2e4ccdb2a89525a914e6d0913 (diff) | |
download | rails-99c103be1165da9c8299bc0977188ecf167e06a5.tar.gz rails-99c103be1165da9c8299bc0977188ecf167e06a5.tar.bz2 rails-99c103be1165da9c8299bc0977188ecf167e06a5.zip |
Fixed bug with polymorphic has_one :as pointing to an STI record
[#2594 state:committed]
Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/associations/has_one_associations_test.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/activerecord/test/cases/associations/has_one_associations_test.rb b/activerecord/test/cases/associations/has_one_associations_test.rb index 1ddb3f49bf..3984945f9f 100644 --- a/activerecord/test/cases/associations/has_one_associations_test.rb +++ b/activerecord/test/cases/associations/has_one_associations_test.rb @@ -2,9 +2,11 @@ require "cases/helper" require 'models/developer' require 'models/project' require 'models/company' +require 'models/sponsor' +require 'models/organization' class HasOneAssociationsTest < ActiveRecord::TestCase - fixtures :accounts, :companies, :developers, :projects, :developers_projects + fixtures :accounts, :companies, :developers, :projects, :developers_projects, :organizations, :sponsors def setup Account.destroyed_account_ids.clear @@ -306,4 +308,9 @@ class HasOneAssociationsTest < ActiveRecord::TestCase Firm.find(@firm.id, :include => :account).save! end end + + def test_polymorphic_sti + assert_equal organizations(:sponsorable), sponsors(:org_sponsor).sponsorable + assert_equal sponsors(:org_sponsor), organizations(:sponsorable).sponsor + end end |