aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2017-01-30 14:10:33 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2017-01-30 14:10:33 -0800
commitf91bc245978f9e42ae48a553e481fcc48d2a97bd (patch)
tree5379e21a98fbf99c69d736ca288088c6c40fa895 /activerecord
parentd3851621de4efd74e34777aca8626a146c03d4b1 (diff)
downloadrails-f91bc245978f9e42ae48a553e481fcc48d2a97bd.tar.gz
rails-f91bc245978f9e42ae48a553e481fcc48d2a97bd.tar.bz2
rails-f91bc245978f9e42ae48a553e481fcc48d2a97bd.zip
update comments and call `super`
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/reflection.rb27
1 files changed, 3 insertions, 24 deletions
diff --git a/activerecord/lib/active_record/reflection.rb b/activerecord/lib/active_record/reflection.rb
index cb240229a5..71993a4fe4 100644
--- a/activerecord/lib/active_record/reflection.rb
+++ b/activerecord/lib/active_record/reflection.rb
@@ -175,6 +175,8 @@ module ActiveRecord
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 @@ module ActiveRecord
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