From b2fa70a8e1a7a02873e54bb38abafabdd103476a Mon Sep 17 00:00:00 2001 From: Marcel Molina Date: Wed, 23 Jan 2008 17:06:40 +0000 Subject: Indicate in documentation that newer version of AR support eager loading in polymorphic associations. Closes #10861 [fxn] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8707 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/lib/active_record/associations.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'activerecord/lib/active_record/associations.rb') diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index 3692be3aeb..cb17b6e483 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -487,7 +487,8 @@ module ActiveRecord # When eager loaded, conditions are interpolated in the context of the model class, not the model instance. Conditions are lazily interpolated # before the actual model exists. # - # Eager loading is not possible with polymorphic associations. Given + # Eager loading is not supported with polymorphic associations up to (and including) + # version 2.0.2. Given # # class Address < ActiveRecord::Base # belongs_to :addressable, :polymorphic => true @@ -500,6 +501,9 @@ module ActiveRecord # will raise ActiveRecord::EagerLoadPolymorphicError. The reason is that the parent model's type # is a column value so its corresponding table name cannot be put in the FROM/JOIN clauses of that early query. # + # In versions greater than 2.0.2 eager loading in polymorphic associations is supported + # thanks to a change in the overall preloading strategy. + # # It does work the other way around though: if the User model is addressable you can eager load # their addresses with :include just fine, every piece needed to construct the query is known beforehand. # -- cgit v1.2.3