app/filters/attribute_filter/country_filter.rb
module AttributeFilter
class CountryFilter < ApplicationFilter
filter_params do
optional(:country).value(:string)
end
def apply
return super if filter_params.blank?
super.where(options.fetch(:attribute_name, :country_code) => filter_params.fetch(:country))
end
end
end