Flowdock
method

construct

Importance_0
Ruby on Rails latest stable (v6.1.7.7) - 0 notes - Class: ActiveRecord::Associations::ClassMethods::JoinDependency

Method deprecated or moved

This method is deprecated or moved on the latest stable version. The last existing version (v3.0.9) is shown here.

These similar methods exist in v6.1.7.7:

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.