Flowdock
method

conditions

Importance_2
v3.2.13 - Show latest stable - 0 notes - Class: ActiveRecord::Reflection::ThroughReflection
conditions() 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 conditions 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 conditions corresponding to the chain. Each item in the #conditions array corresponds to an item in the #chain, and is itself an array of conditions from an arbitrary number of relevant reflections, plus any :source_type or polymorphic :as constraints.

Show source
Register or log in to add new notes.