提交 b2fa70a8 编写于 作者: M Marcel Molina

Indicate in documentation that newer version of AR support eager loading in...

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
上级 349df756
......@@ -487,7 +487,8 @@ def clear_association_cache #:nodoc:
# 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 @@ def clear_association_cache #:nodoc:
# will raise <tt>ActiveRecord::EagerLoadPolymorphicError</tt>. 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 <tt>User</tt> model is <tt>addressable</tt> you can eager load
# their addresses with <tt>:include</tt> just fine, every piece needed to construct the query is known beforehand.
#
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册