rails/rails — pull request #15861 by jamesyang124 (2014-06-22 15:21:52+00:00)
Title: add arel.bind_values for polymorphic joins #15821.

It seems `arel` gem changes its behavior which puts dynamic parameter value of sql statement to `arel.bind_values` rather than directly assign values to sql statement:

```ruby
# rails 4.1.2.rc2
# arel 5.0.0
Post Load (0.1ms) SELECT "posts".* FROM "posts" INNER JOIN "slugs" ON
"slugs"."sluggable_id" = "posts"."id" AND "slugs"."sluggable_type" = 'Post'
WHERE "slugs"."name" = 'the-slug'

# rails master
# arel 6.0.0
Post Load (0.1ms) SELECT "posts".* FROM "posts" INNER JOIN "slugs" ON
"slugs"."sluggable_id" = "posts"."id" AND "slugs"."sluggable_type" = ?
WHERE "slugs"."name" = 'the-slug' [[nil, "Post"]]

# /activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
require 'arel/collectors/bind'
require 'arel/collectors/sql_string'
```

Instead of passing binding values from `exists?`'s, we may prepend `arel.bind_values` to `relation.bind_values` which pass the test cases provide by [issue_15821](https://github.com/rails/rails/issues/15821). It this change is feasible. I will include test case in further commit.