Skip to content

Instantly share code, notes, and snippets.

View phurni's full-sized avatar

Pascal Hurni phurni

View GitHub Profile
@phurni
phurni / filterable.rb
Last active February 21, 2020 15:45 — forked from justinweiss/filterable.rb
Filterable
# Call scopes directly from your URL params:
#
# @products = Product.filter(params.slice(:status, :location, :starts_with))
module Filterable
extend ActiveSupport::Concern
module ClassMethods
# Call the class methods with names based on the keys in <tt>filtering_params</tt>
# with their associated values. For example, "{ status: 'delayed' }" would call