Method: Might::SortParametersExtractor#call

Defined in:
lib/might/sort_parameters_extractor.rb

#call(env) ⇒ <<Might::RansackableSort::SortParameter, []>]

Returns <<Might::RansackableSort::SortParameter, []>].

Parameters:

  • env (<String, []>)
    • first element is a scope to be sorted

    • second is a String with user provided sortings

Returns:

  • (<<Might::RansackableSort::SortParameter, []>])

    <<Might::RansackableSort::SortParameter, []>]



29
30
31
32
33
34
35
36
37
# File 'lib/might/sort_parameters_extractor.rb', line 29

def call(env)
  params, errors = env

  sort_params = sort_order(params[:sort]).map do |(attribute, direction)|
    extract_parameter(attribute, direction)
  end

  app.call([params.merge(sort: sort_params), errors])
end