app/models/manager_refresh/inventory_collection.rb
def db_relation(selection = nil, projection = nil)
      relation = if !custom_db_finder.blank?
                   custom_db_finder.call(self, selection, projection)
                 else
                   rel = if !parent.nil? && !association.nil?
                           parent.send(association)
                         elsif !arel.nil?
                           arel
                         end
                   rel = rel.where(selection) if rel && selection
                   rel = rel.select(projection) if rel && projection
                   rel
                 end

      relation || model_class.none
    end
# Return a Rails relation or array that will be used to obtain the records we need to load from the DB
#
# @param selection [Hash] A selection hash resulting in Select operation (in Relation algebra terms)
# @param projection [Array] A projection array resulting in Project operation (in Relation algebra terms)
Return a Rails relation or array that will be used to obtain the records we need to load from the DB
Return a Rails relation or array that will be used to obtain the records we need to load from the DB
def db_relation(selection = nil, projection = nil)
      relation = if !custom_db_finder.blank?
                   custom_db_finder.call(self, selection, projection)
                 else
                   rel = if !parent.nil? && !association.nil?
                           parent.send(association)
                         elsif !arel.nil?
                           arel
                         end
                   rel = rel.where(selection) if rel && selection
                   rel = rel.select(projection) if rel && projection
                   rel
                 end
      relation || model_class.none
    end
def db_relation ( selection = nil , projection = nil ) relation = if ! custom_db_finder . blank? custom_db_finder . call ( self , selection , projection ) else rel = if ! parent . nil? && ! association . nil? parent . send ( association ) elsif ! arel . nil? arel end rel = rel . where ( selection ) if rel && selection rel = rel . select ( projection ) if rel && projection rel end relation || model_class . none end
Return a Rails relation or array that will be used to obtain the records we need to load from the DB
Return a Rails relation or array that will be used to obtain the records we need to load from the DB
selection
A selection hash resulting in Select operation (in Relation algebra terms)
A selection hash resulting in Select operation ( in Relation algebra terms )
projection
A projection array resulting in Project operation (in Relation algebra terms)
A projection array resulting in Project operation ( in Relation algebra terms )