-
-
Notifications
You must be signed in to change notification settings - Fork 810
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
Wrong result and errors for join/group/having scope with certain values (0 and 1) #502
Comments
+1 here but looks like fix 502 will see us through. Thank you! |
Don't replace 0 and 1 with false and true, fixes #502 [skip ci]
I think this commit (9f4e48e) might break a really common use case. Let's say there's a checkbox like: <input name="search[my_bool_eq]" value="1"> And that value goes straight into a search, like: MyRecord.search(params['search']) Before this commit, So, this commit breaks a really common use case, right? We'd have to do some manual typecasting in our controller now. Was that an intentional change? If so, I'd recommend bumping the major version of ransack, because I think it's gonna break a lot of apps out there. CC: @jonatack (Do you want a new issue for this?) |
@avit so I just change my code to this? Cart.ransack(items_count_equals: [1]).result |
@gkop yup, that's right! |
Ah excellent. I suppose I will need to patch activeadmin now :) |
It seems that this is also a problem when the strings 't' or 'f' are passed in. |
Testing ransack v1.6.3, rails 4.1.8
Passing in positive integer values other than 0 and 1 appears to produce the expected results.
This unexpected behavior also appears when using named scopes rather than class methods and when querying for
<
and>
in addition to=
.When using named a named scope and a lambda, the error is different in the case when 1 is passed in:
This suggests to me this bug may be connected to #404 .
The text was updated successfully, but these errors were encountered: