lib/scaffolding_extensions/model/sequel.rb
# Retrieve multiple objects given a hash of options
Retrieve multiple objects given a hash of options
Retrieve multiple objects given a hash of options
def scaffold_get_objects(options)
    records = dataset
    records = records.send(scaffold_use_eager_graph ? :eager_graph : :eager, *options[:include]) if options[:include]
    records = records.order(*options[:order]) if options[:order]
    records = records.limit(options[:limit], options[:offset]) if options[:limit]
    conditions = options[:conditions]
    if conditions && Array === conditions && conditions.length > 0
      if String === conditions[0]
        records = records.filter(*conditions)
      else
        conditions.each do |cond|
          next if cond.nil?
          records = case cond
            when Hash, String then records.filter(cond)
            when Array then records.filter(*cond)
            when Proc then records.filter(&cond)
          end
        end
      end
    end
    records.all
  end
def scaffold_get_objects ( options ) records = dataset records = records . send ( scaffold_use_eager_graph ? :eager_graph : :eager , * options [ :include ] ) if options [ :include ] records = records . order ( * options [ :order ] ) if options [ :order ] records = records . limit ( options [ :limit ] , options [ :offset ] ) if options [ :limit ] conditions = options [ :conditions ] if conditions && Array === conditions && conditions . length > 0 if String === conditions [ 0 ] records = records . filter ( * conditions ) else conditions . each do | cond | next if cond . nil? records = case cond when Hash , String then records . filter ( cond ) when Array then records . filter ( * cond ) when Proc then records . filter ( & cond ) end end end end records . all end
Retrieve multiple objects given a hash of options
Retrieve multiple objects given a hash of options
options
<not_specific>