Skip to content

Instantly share code, notes, and snippets.

View haseebeqx's full-sized avatar
🟢
Building software

Haseeb Annadamban haseebeqx

🟢
Building software
View GitHub Profile
@justinweiss
justinweiss / filterable.rb
Last active January 11, 2024 07:28
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