提交 f81d771f 编写于 作者: J Jack Danger Canty

doc: ActiveRecord::Reflection::AssociationReflection#through_reflection

Added documentation demonstrating the use of #through_reflection for
finding intervening reflection objects for HasManyThrough
and HasOneThrough.
上级 405de50a
......@@ -153,6 +153,17 @@ def counter_cache_column
end
end
# Returns the AssociationReflection object specified in the <tt>:through</tt> option
# of a HasMantThrough or HasOneThrough association. Example:
#
# class Post < ActiveRecord::Base
# has_many :taggings
# has_many :tags, :through => :taggings
# end
#
# tags_reflection = Post.reflect_on_association(:tags)
# taggings_reflection = tags_reflection.through_reflection
#
def through_reflection
@through_reflection ||= options[:through] ? active_record.reflect_on_association(options[:through]) : false
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册