-
Notifications
You must be signed in to change notification settings - Fork 390
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
missing bind values #363
Comments
cc @sgrif |
What version are you upgrading from? It looks like you're grabbing the AST from the relation, but leaving the bind values behind, but this shouldn't have worked in 4.1 either. (Also insert requisite warning about how you're reaching deeply into AR internals in unsupported ways that will likely break between versions) |
my rails app uses 4.1.7, but 4.1.10 still produces the desired SQL. Here is a gist that uses SelectManager#union, instead of passing |
Thanks, I'll look into this. |
interesting, calling If this is an ActiveRecord issue I can close this and open in the rails repo |
It's not really an Active Record or an Arel issue, it's just incorrect usage. Like I mentioned originally, yeah the problem is that you're not passing the bind values. I would have expected that query to use bind values in 4.1, which was the thing I was going to look into, but it appears that query didn't use bind values in 4.1 |
@sgrif Sorry to reopen such old issue I am trying to investigate an issue where in Rails 4.2 bind values are not passed to down to two different libraries that use AREL and ActiveRecord: Squeel and BabySqueel How would you rewrite this query to allow bind values to be used by AST? |
I'd love to know this as well. I'm up to my elbows in Arel at the moment—if I figure anything out I'll report back. |
|
while upgrading a rails app to 4.2 i ran into some malformed SQL. My app has many polymorphic associations and i use unions religiously to leverage composite indices. The ruby code below can be run with both arel 5 and 6 by toggling the
gem 'activerecord'
lines at the top. The code uses an in-memory sqlite database so you should be able to run it directly from your favorite text editor.I have included the SQL output below and version 6 has no query parameter assignments
The text was updated successfully, but these errors were encountered: