Sha256: 7f4af42b5dd5e240944cdd14344b5d03ccce2d9cea8ffe55779d871108844bb2
Contents?: true
Size: 472 Bytes
Versions: 9
Compression:
Stored size: 472 Bytes
Contents
module Might # Converts array of parameters to hash familiar to ransack gem # class RansackableSortParametersAdapter def initialize(app) @app = app end def call(env) scope, params = env ransackable_parameters = Array(params[:sort]).map do |parameter| "#{parameter.name} #{parameter.direction}" end app.call([scope, params.merge(sort: ransackable_parameters)]) end private attr_reader :app end end
Version data entries
9 entries across 9 versions & 1 rubygems