method

create

Importance_0
v6.1.3.1 - Show latest stable - 0 notes - Class: AliasTracker
create(connection, initial_table, joins, aliases = nil) public

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/alias_tracker.rb, line 9
      def self.create(connection, initial_table, joins, aliases = nil)
        if joins.empty?
          aliases ||= Hash.new(0)
        elsif aliases
          default_proc = aliases.default_proc || proc { 0 }
          aliases.default_proc = proc { |h, k|
            h[k] = initial_count_for(connection, k, joins) + default_proc.call(h, k)
          }
        else
          aliases = Hash.new { |h, k|
            h[k] = initial_count_for(connection, k, joins)
          }
        end
        aliases[initial_table] = 1
        new(connection, aliases)
      end
Register or log in to add new notes.