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
predicate present or true with null checkbox #434
Comments
Before looking into this, here is a copy-paste of my reply to a similar issue recently. This is still working fine in Ransack 1.4 for me. For handling boolean results in searches, I've found I usually need three states: In that case, assuming your checkbox <%= f.select :field_not_eq, [['True', 0], ['False', 1], ['All', 2]] %> or <%= f.select :field_not_eq, [['Yes', 0], ['No', 1], ['All', 2]] %> |
If your unchecked value is That should give you |
@kaluznyo Don't know if you've seen this or not: http://stackoverflow.com/questions/27890997/ransack-return-records-with-boolean-attribute-both-true-and-false-with-checkbox TL;DR include the |
@kaluznyo I did the following: f.check_box :field_true, {}, 1, nil nil is the value when is not checked. Did you find a simpler way? |
Hi,
Before 1.4, i use check box with field_present or field_true. If the check box is not checked, no condition is add to request.
But since 1.4 if I use this, I get 'WHERE field != 1' when check box is not checked.
Seem to be related to this features #335.
What is the 'new' way to make this work again. No check -> ignore predicat.
The text was updated successfully, but these errors were encountered: