avo
avo copied to clipboard
`add_filters_for_all_fields` dynamic filters helper
Feature
Naming is TBD
We'd like to have a way to add all the possible dynamic filters for all index fields.
Current workarounds
Screenshots or screen recordings
Additional context
# == Schema Information
#
# Table name: courses
#
# id :bigint not null, primary key
# name :string
# created_at :datetime not null
# updated_at :datetime not null
# skills :text default([]), is an Array
# country :string
# city :string
# starting_at :time
#
class Course < ApplicationRecord
# ...
end
class Avo::Resources::Course < Avo::BaseResource
def fields
field :name
field :city, hide_on: :index
end
def filters
add_filters_for_all_fields
end
end
Output: The course index page should have 1 filter, for name
This issue has been marked as stale because there was no activity for the past 15 days.
Just a random thought: the filterable option should become true by default in Avo4. At least for me, every time I've used Avo in an application, I've turned filterable to true on all fields.