Class: Decidim::Core::BaseInputSort

Inherits:
GraphQL::Schema::InputObject
  • Object
show all
Defined in:
decidim-core/lib/decidim/api/input_sorts/base_input_sort.rb

Instance Method Summary collapse

Instance Method Details

#prepareObject

Overwrite the prepare method to allow 2 possible values only



7
8
9
10
11
12
13
14
# File 'decidim-core/lib/decidim/api/input_sorts/base_input_sort.rb', line 7

def prepare
  arguments.each do |key, value|
    next if key.to_s == "locale"
    next if value.respond_to?(:call)
    raise GraphQL::ExecutionError, "Invalid order value for #{key.inspect}, only ASC or DESC are valids (received #{value.inspect})" unless valid_order?(value)
  end
  super
end