Skip to content

Instantly share code, notes, and snippets.

View wolfieorama's full-sized avatar
🎯
Focusing

wolfieorama

🎯
Focusing
  • Nairobi, Kigali and else where
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