aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/relation_test.rb
diff options
context:
space:
mode:
authorSean Griffin <sean@seantheprogrammer.com>2017-07-24 08:19:35 -0400
committerSean Griffin <sean@seantheprogrammer.com>2017-07-24 09:07:24 -0400
commit213796fb4936dce1da2f0c097a054e1af5c25c2c (patch)
tree9178558ae4108ce96b9b41bd98f000684aac034b /activerecord/test/cases/relation_test.rb
parent0449d8b6bc02f4c0a416a7c40550e3b8b988d113 (diff)
downloadrails-213796fb4936dce1da2f0c097a054e1af5c25c2c.tar.gz
rails-213796fb4936dce1da2f0c097a054e1af5c25c2c.tar.bz2
rails-213796fb4936dce1da2f0c097a054e1af5c25c2c.zip
Refactor Active Record to let Arel manage bind params
A common source of bugs and code bloat within Active Record has been the need for us to maintain the list of bind values separately from the AST they're associated with. This makes any sort of AST manipulation incredibly difficult, as any time we want to potentially insert or remove an AST node, we need to traverse the entire tree to find where the associated bind parameters are. With this change, the bind parameters now live on the AST directly. Active Record does not need to know or care about them until the final AST traversal for SQL construction. Rather than returning just the SQL, the Arel collector will now return both the SQL and the bind parameters. At this point the connection adapter will have all the values that it had before. A bit of this code is janky and something I'd like to refactor later. In particular, I don't like how we're handling associations in the predicate builder, the special casing of `StatementCache::Substitute` in `QueryAttribute`, or generally how we're handling bind value replacement in the statement cache when prepared statements are disabled. This also mostly reverts #26378, as it moved all the code into a location that I wanted to delete. /cc @metaskills @yahonda, this change will affect the adapters Fixes #29766. Fixes #29804. Fixes #26541. Close #28539. Close #24769. Close #26468. Close #26202. There are probably other issues/PRs that can be closed because of this commit, but that's all I could find on the first few pages.
Diffstat (limited to 'activerecord/test/cases/relation_test.rb')
-rw-r--r--activerecord/test/cases/relation_test.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/test/cases/relation_test.rb b/activerecord/test/cases/relation_test.rb
index b1e14f8dc4..f22fcd7b5a 100644
--- a/activerecord/test/cases/relation_test.rb
+++ b/activerecord/test/cases/relation_test.rb
@@ -185,7 +185,7 @@ module ActiveRecord
relation = Relation.new(klass, :b, nil)
relation.merge!(where: ["foo = ?", "bar"])
- assert_equal Relation::WhereClause.new(["foo = bar"], []), relation.where_clause
+ assert_equal Relation::WhereClause.new(["foo = bar"]), relation.where_clause
end
def test_merging_readonly_false