method

scope_chain

Importance_1
v4.1.8 - Show latest stable - 0 notes - Class: ActiveRecord::Reflection::ThroughReflection
scope_chain() public

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.

Show source
Register or log in to add new notes.