aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/relation/from_clause.rb
diff options
context:
space:
mode:
authorSean Griffin <sean@thoughtbot.com>2015-01-27 09:15:22 -0700
committerSean Griffin <sean@thoughtbot.com>2015-01-27 09:18:30 -0700
commit16ce2eecd3eb23034555bb37b29c12985243d908 (patch)
treebfced5ffbc70aef244ff5a57c0d060028b9e7f4f /activerecord/lib/active_record/relation/from_clause.rb
parentad20b41cb941ac4271b58e083edba57cc6233b82 (diff)
downloadrails-16ce2eecd3eb23034555bb37b29c12985243d908.tar.gz
rails-16ce2eecd3eb23034555bb37b29c12985243d908.tar.bz2
rails-16ce2eecd3eb23034555bb37b29c12985243d908.zip
Unify access to bind values on Relation
The bind values can come from four places. `having`, `where`, `joins`, and `from` when selecting from a subquery that contains binds. These need to be kept in a specific order, since the clauses will always appear in that order. Up until recently, they were not. Additionally, `joins` actually did keep its bind values in a separate location (presumably because it's the only case that people noticed was broken). However, this meant that anything accessing just `bind_values` was broken (which most places were). This is no longer possible, there is only a single way to access the bind values, and it includes joins in the proper location. The setter was removed yesterday, so breaking `+=` cases is not possible. I'm still not happy that `joins` is putting it's bind values on the Arel AST, and I'm planning on refactoring it further, but this removes a ton of bug cases.
Diffstat (limited to 'activerecord/lib/active_record/relation/from_clause.rb')
-rw-r--r--activerecord/lib/active_record/relation/from_clause.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/relation/from_clause.rb b/activerecord/lib/active_record/relation/from_clause.rb
index fc16ac58b4..8022901524 100644
--- a/activerecord/lib/active_record/relation/from_clause.rb
+++ b/activerecord/lib/active_record/relation/from_clause.rb
@@ -10,7 +10,7 @@ module ActiveRecord
def binds
if value.is_a?(Relation)
- value.arel.bind_values + value.bind_values
+ value.bind_values
else
[]
end