class Might::FilterMiddleware

Filter scope using ransack gem

Attributes

app[R]

Public Class Methods

new(app) click to toggle source

@param app [#call, Proc]

# File lib/might/filter_middleware.rb, line 8
def initialize(app)
  @app = app
end

Public Instance Methods

call(env) click to toggle source
# File lib/might/filter_middleware.rb, line 12
def call(env)
  scope, = ::Middleware::Builder.new do |b|
    b.use RansackableFilterParametersAdapter
    b.use RansackableFilter
  end.call(env)

  app.call([scope, env[1]])
end