Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

boolean filter check_boxes do not work as expected #2227

Closed
marcusg opened this issue May 25, 2013 · 3 comments
Closed

boolean filter check_boxes do not work as expected #2227

marcusg opened this issue May 25, 2013 · 3 comments
Labels

Comments

@marcusg
Copy link
Contributor

marcusg commented May 25, 2013

given my model Page has a visible flag and I have the following filters

filter :name
filter :visible

accessing the Page AA shows the filters correctly. But I am not able to filter for Pages that are invisible, because leaving the checkbox untouched results in no parameter passed to meta_search. Maybe I'm missing something important here...

@seanlinsley
Copy link
Contributor

Yeah, that's the problem with checkboxes: there's only two possible values: on and off. For the boolean filter, off must mean "don't use this filter" otherwise it wouldn't act like all the other filters.

Instead of a checkbox we might want to have two radio buttons instead. Or maybe even three:

  • true
  • false
  • nil

@timoschilling
Copy link
Member

since we changed to ransack, we now have a checkbox with yes/no/any int that case, I think we can close this

@Shoroh
Copy link

Shoroh commented Apr 21, 2015

Hi guys!

Is there a better way to make a single checkbox instead of two (with yes & no) if boolean field? I use some trick at the moment:

filter :garden, as: :check_boxes, collection: [['Garden', true]], label: ''

look at :garden case below:

screen shot 2015-04-21 at 09 41 46

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants