app/models/manager_refresh/inventory_collection.rb
def populate_db_data_index!
      # Load only new references from the DB
      new_references = references - loaded_references
      # And store which references we've already loaded
      loaded_references.merge(new_references)

      # Initialize db_data_index in nil
      self.db_data_index ||= {}

      # TODO(lsmola) selected need to contain also :keys used in other InventoryCollections pointing to this one, once
      # we get list of all keys for each InventoryCollection ,we can uncomnent
      # selected   = [:id] + manager_ref.map { |x| model_class.reflect_on_association(x).try(:foreign_key) || x }
      # selected << :type if model_class.new.respond_to? :type
      # load_from_db.select(selected).find_each do |record|

      # Return the the correct relation based on strategy and selection&projection
      case strategy
      when :local_db_cache_all
        selection  = nil
        projection = nil
      else
        selection  = extract_references(new_references)
        projection = nil
      end

      db_relation(selection, projection).find_each do |record|
        process_db_record!(record)
      end
    end
# Fills db_data_index with InventoryObjects obtained from the DB
Fills db_data_index with InventoryObjects obtained from the DB
Fills db_data_index with InventoryObjects obtained from the DB
def populate_db_data_index!
      new_references = references - loaded_references
      loaded_references.merge(new_references)
      self.db_data_index ||= {}
      case strategy
      when :local_db_cache_all
        selection  = nil
        projection = nil
      else
        selection  = extract_references(new_references)
        projection = nil
      end
      db_relation(selection, projection).find_each do |record|
        process_db_record!(record)
      end
    end
def populate_db_data_index! new_references = references - loaded_references loaded_references . merge ( new_references ) self . db_data_index ||= { } case strategy when :local_db_cache_all selection = nil projection = nil else selection = extract_references ( new_references ) projection = nil end db_relation ( selection , projection ) . find_each do | record | process_db_record! ( record ) end end
Fills db_data_index with InventoryObjects obtained from the DB
Fills db_data_index with InventoryObjects obtained from the DB
# Load only new references from the DB # And store which references we've already loaded # Initialize db_data_index in nil # TODO(lsmola) selected need to contain also :keys used in other InventoryCollections pointing to this one, once # we get list of all keys for each InventoryCollection ,we can uncomnent # selected   = [:id] + manager_ref.map { |x| model_class.reflect_on_association(x).try(:foreign_key) || x } # selected << :type if model_class.new.respond_to? :type # load_from_db.select(selected).find_each do |record| # Return the the correct relation based on strategy and selection&projection