Flowdock
method

new

Importance_2
v4.0.2 - Show latest stable - 0 notes - Class: JoinDependency
new(base, associations, joins) public

base is the base class on which operation is taking place. associations is the list of associations which are joined using hash, symbol or array. joins is the list of all string join commnads and arel nodes.

Example :

class Physician < ActiveRecord::Base
  has_many :appointments
  has_many :patients, through: :appointments
end

If I execute `@physician.patients.to_a` then
  base #=> Physician
  associations #=> []
  joins #=>  [#<Arel::Nodes::InnerJoin: ...]

However if I execute `Physician.joins(:appointments).to_a` then
  base #=> Physician
  associations #=> [:appointments]
  joins #=>  []
Show source
Register or log in to add new notes.