update comments and call `super`

上级 d3851621
......@@ -175,6 +175,8 @@ def join_keys(association_klass)
JoinKeys.new(foreign_key, active_record_primary_key)
end
# Returns a list of scopes that should be applied for this Reflection
# object when querying the database.
def scopes
scope ? [scope] : []
end
......@@ -798,31 +800,8 @@ def clear_association_scope_cache # :nodoc:
through_reflection.clear_association_scope_cache
end
# Consider the following example:
#
# class Person
# has_many :articles
# has_many :comment_tags, through: :articles
# end
#
# class Article
# has_many :comments
# has_many :comment_tags, through: :comments, source: :tags
# end
#
# class Comment
# has_many :tags
# end
#
# There may be scopes on Person.comment_tags, Article.comment_tags and/or Comment.tags,
# but only Comment.tags will be represented in the #chain. So this method creates an array
# of scopes corresponding to the chain.
def scopes
if scope
source_reflection.scopes + [scope]
else
source_reflection.scopes
end
source_reflection.scopes + super
end
def source_type_scope
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册