method
construct
v2.1.0 -
Show latest stable
-
0 notes -
Class: ActiveRecord::Associations::ClassMethods::JoinDependency
construct(parent, associations, joins, row)
protected
Hide source
# File activerecord/lib/active_record/associations.rb, line 1686 def construct(parent, associations, joins, row) case associations when Symbol, String while (join = joins.shift).reflection.name.to_s != associations.to_s raise ConfigurationError, "Not Enough Associations" if joins.empty? end construct_association(parent, join, row) when Array associations.each do |association| construct(parent, association, joins, row) end when Hash associations.keys.sort{|a,b|a.to_s<=>b.to_s}.each do |name| association = construct_association(parent, joins.shift, row) construct(association, associations[name], joins, row) if association end else raise ConfigurationError, associations.inspect end end