Module: Enumerable

Defined in:
lib/custom_sort/enumerable.rb

Instance Method Summary collapse

Instance Method Details

#customsort_by_field(query_name, *args, **options, &block) ⇒ Object



40
41
42
43
44
45
46
47
48
49
# File 'lib/custom_sort/enumerable.rb', line 40

def customsort_by_field(query_name, *args, **options, &block)
  if block || !respond_to?(:scoping)
    raise ArgumentError, "wrong number of arguments (given #{args.size + 1}, expected 1)" if args.any?

    #CustomSort::Magic.validate_period(period, options.delete(:permit))
    send("customsort_by_#{query_name}", **options, &block)
  else
    scoping { @klass.customsort_by_field(query_name, *args, **options, &block) }
  end
end