Skip to content

Instantly share code, notes, and snippets.

View maokomioko's full-sized avatar

Mike Eirih maokomioko

View GitHub Profile
@maokomioko
maokomioko / home_name_dynamic_filter.rb
Last active July 17, 2025 01:57
Customisable dynamic filters in Avo (https://avohq.io/)
module HomeNameDynamicFilter
extend ActiveSupport::Concern
# Adds a dynamic filter for filtering by home names
#
# @param association_path [Symbol, Hash, nil] The association path from the resource's model to Home
# - nil (default): Assumes the model has a direct :home association or home_id column
# - Symbol: Direct association name (e.g., :home, :property)
# - Hash: Nested associations (e.g., { reservation: :home }, { contract: { home_ownership: :home } })
#