Introducing Rack::Reducer — map URL params to data filters, in any Rack app
Rack::Reducer is a new gem for safely mapping URL params to functions that filter data.
It handles chaining, sanitizing, and conditional filtering on your behalf, and can make your controller logic as simple as @posts = Post.reduce(params)
.
Your filter functions can ultimately be Rails scopes, inline lambdas, or methods on a query object — Rack::Reducer doesn’t care. It works in any Rack-compatible app, with any ORM, and has no dependencies apart from Rack itself.
Post a comment