def fast_bootstrap(*records)
      primary_key = self.primary_key.to_sym
      
      # Remove records that are no longer being used
      records.flatten!
      ids = records.map {|record| record[primary_key]}.compact
      delete_all(ids.any? ? ["#{primary_key} NOT IN (?)", ids] : nil)
      
      # Find remaining existing records (to be updated)
      quoted_table_name = self.quoted_table_name
      existing = connection.select_all("SELECT * FROM #{quoted_table_name}").inject({}) {|existing, record| existing[record[primary_key.to_s].to_i] = record; existing}
      
      records.each do |attributes|
        attributes.stringify_keys!
        if defaults = attributes.delete('defaults')
          defaults.stringify_keys!
        end
        
        id = attributes[primary_key.to_s]
        if existing_attributes = existing[id]
          # Record exists: Update attributes
          attributes.delete(primary_key.to_s)
          attributes.merge!(defaults.delete_if {|attribute, value| !existing_attributes[attribute].nil?}) if defaults
          update_all(attributes, primary_key => id)
        else
          # Record doesn't exist: create new one
          attributes.merge!(defaults) if defaults
          column_names = []
          values = []
          
          attributes.each do |column_name, value|
            column_names << connection.quote_column_name(column_name)
            values << connection.quote(value, columns_hash[column_name])
          end
          
          connection.insert(
            "INSERT INTO #{quoted_table_name} (#{column_names * ', '}) VALUES(#{values * ', '})",
            "#{name} Create", primary_key, id, sequence_name
          )
        end
      end
      
      true
    end
def fast_bootstrap(*records)
      primary_key = self.primary_key.to_sym
      
      # Remove records that are no longer being used
      records.flatten!
      ids = records.map {|record| record[primary_key]}.compact
      delete_all(ids.any? ? ["#{primary_key} NOT IN (?)", ids] : nil)
      
      # Find remaining existing records (to be updated)
      quoted_table_name = self.quoted_table_name
      existing = connection.select_all("SELECT * FROM #{quoted_table_name}").inject({}) {|existing, record| existing[record[primary_key.to_s].to_i] = record; existing}
      
      records.each do |attributes|
        attributes.stringify_keys!
        if defaults = attributes.delete('defaults')
          defaults.stringify_keys!
        end
        
        id = attributes[primary_key.to_s]
        if existing_attributes = existing[id]
          # Record exists: Update attributes
          attributes.delete(primary_key.to_s)
          attributes.merge!(defaults.delete_if {|attribute, value| !existing_attributes[attribute].nil?}) if defaults
          update_all(attributes, primary_key => id)
        else
          # Record doesn't exist: create new one
          attributes.merge!(defaults) if defaults
          column_names = []
          values = []
          
          attributes.each do |column_name, value|
            column_names << connection.quote_column_name(column_name)
            values << connection.quote(value, columns_hash[column_name])
          end
          
          connection.insert(
            "INSERT INTO #{quoted_table_name} (#{column_names * ', '}) VALUES(#{values * ', '})",
            "#{name} Create", primary_key, id, sequence_name
          )
        end
      end
      
      true
    end
Quickly synchronizes the given records with the existing ones.  This
 skips ActiveRecord altogether, interacting directly with the connection
 instead.  As a result, certain features are not available when being
 bootstrapped, including:
 * Callbacks
 * Validations
 * Transactions
 * Timestamps
 * Dirty attributes

 Also note that records are created directly without creating instances
 of the model.  As a result, all of the attributes for the record must be
 specified.

 This produces a significant performance increase when bootstrapping more
 than several hundred records.

 See EnumerateBy::Bootstrapped#bootstrap for information about usage.