How can i filter a boolean value using a single checkbox?
For example the following gives me two checkboxes with yes
and no
values:
ActiveAdmin.register User do
filter :is_retired, :as => :check_boxes
end
HBTM association is filtered as follows:
filter :roles_id, :as => :check_boxes, :collection => proc { Role.all }
But i have a boolean field in my User
model and need a single checkbox with Is retired
label. Is it possible somehow?
filter :is_retired,
as: :check_boxes,
collection: [['Yes', true]],
label: 'Retired?'
As suggested elsewhere use
filter :enabled, as: :select, collection: [["Yes", true], ["No", false]]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With