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

Doesn't work with Rails 4.2 #2

Closed
remigijusj opened this issue Apr 3, 2015 · 4 comments
Closed

Doesn't work with Rails 4.2 #2

remigijusj opened this issue Apr 3, 2015 · 4 comments

Comments

@remigijusj
Copy link

Rails 4.2 changed some internals of ActiveRecord query-building, so your code for or-conditions doesn't work. More specifically, or_query method in manager.rb fails to build a valid query.

The problem is that setting where_values does not affect bind_values, and the
latter doen't fill all of the ? slots in the resulting query.

I was able to work around the issue by applying the following patch:
https://gist.github.com/remigijusj/65ce558215292b85948b
However it doesn't quite work with and-joined or conditions (see filter_by_params!)

I could find little info about the change in ActiveRecord. Some links here:
http://qiita.com/joker1007/items/5c851526e73b3bc0273a
http://stackoverflow.com/questions/27627390/or-operator-in-where-clause-with-arel-in-rails-4-2

@remigijusj
Copy link
Author

Here is a simplified patch:
https://gist.github.com/remigijusj/e3c540dcdaf114985c65

@Nedomas
Copy link
Owner

Nedomas commented Apr 4, 2015

Hello, Remi!

Ill release your patch as soon as I get back to the keyboard (in a few days).

Thanks for figuring it out 👍

@Nedomas
Copy link
Owner

Nedomas commented Apr 10, 2015

Fix is at #4

@Nedomas
Copy link
Owner

Nedomas commented Apr 10, 2015

Released with v3.1.2. Thank you ❤️

@Nedomas Nedomas closed this as completed Apr 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants