-
-
Notifications
You must be signed in to change notification settings - Fork 807
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
Allow passing stringy booleans as scope args #460
Allow passing stringy booleans as scope args #460
Conversation
a746330
to
0a2d956
Compare
Thanks, @shekibobo! Would you/could you add tests for this and possibly update the change log? |
Probably. I didn't really see any tests for the scoping feature, so I wasn't quite sure where to add it. |
Trying to make this happen: it "applies stringy boolean scopes with boolean values in an array" do
search = Person.search('true_or_false' => ['true'])
search.result.to_sql.should include "true_or_false = 1"
end But it fails with:
I've tested it, and it appears to work correctly on my machine, but I'm not sure what I might be missing on that one. |
3b4bfe6
to
93033f7
Compare
Thanks! The new feature of detecting attribute names containing Thanks for removing the whitespace in the change log. Ransack v.1.5.1 is already released, so this PR should go in a new It's late, so I'll have another look at this tomorrow. |
This implements the solution discussed in activerecord-hackery#403. Fixes activerecord-hackery#403.
93033f7
to
314e28f
Compare
Should I include those specs as pending? |
Also, I'm unsure what SQL clause we should be checking for. Is it |
Hey, it all actually works now! 😹 Specs for boolean scope arguments being passed in an array work, and scopes work if boolean arguments are passed as strings. |
Woo! Passing on all builds! |
Allow passing stringy booleans as scope args. Fixes #403.
Looks pretty good. Let's give it a try. |
This implements the solution discussed in #403.
Fixes #403.