forked from activeadmin/activeadmin
-
Notifications
You must be signed in to change notification settings - Fork 0
Customizing filter form fields
amiel edited this page Apr 8, 2013
·
3 revisions
The filter form builder looks for custom input fields as ActiveAdmin::Inputs::Filter#{as_option.camelize}Field
.
Here's an example taken from the mailing list:
# Somewhere, in an initializer or just straight in your activeadmin file:
class ActiveAdmin::Inputs::FilterIsArchivedInput < ActiveAdmin::Inputs::FilterSelectInput
def input_options
super.merge include_blank: 'All'
end
def collection
[ ['Live', 'true'], ['Archived', 'false'] ]
end
end
# In activeadmin
filter :archived, as: :is_archived
Read more about custom inputs in the formtastic documentation and check out the other filter inputs in lib/active_admin/inputs
to learn more.