Sha256: 801cf6dce8adb7d6015cc6e80ee0d8eb0fe8032839b6a5b582dbea54f54953b3
Contents?: true
Size: 480 Bytes
Versions: 7
Compression:
Stored size: 480 Bytes
Contents
# Define order by filter rule # module QueryFilter::Rules class OrderBy < Scope DIRECTIONS = %w[asc desc].freeze def name 'order_by'.freeze end def valid?(params) params[key].present? && DIRECTIONS.include?(params[direction_key].try(:downcase)) end def direction_key @direction_key ||= (@options[:via] || 'sort_direction').to_sym end def normalize_params(values) [values[key], values[direction_key]] end end end
Version data entries
7 entries across 7 versions & 1 rubygems