Flowdock
method

construct

Importance_0
construct(parent, associations, joins, row) protected

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/associations.rb, line 1986
            def construct(parent, associations, joins, row)
              case associations
                when Symbol, String
                  join = joins.detect{|j| j.reflection.name.to_s == associations.to_s && j.parent_table_name == parent.class.table_name }
                  raise(ConfigurationError, "No such association") if join.nil?

                  joins.delete(join)
                  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|
                    join = joins.detect{|j| j.reflection.name.to_s == name.to_s && j.parent_table_name == parent.class.table_name }
                    raise(ConfigurationError, "No such association") if join.nil?

                    association = construct_association(parent, join, row)
                    joins.delete(join)
                    construct(association, associations[name], joins, row) if association
                  end
                else
                  raise ConfigurationError, associations.inspect
              end
            end
Register or log in to add new notes.