diff options
author | Sean Griffin <sean@thoughtbot.com> | 2015-01-09 10:29:13 -0700 |
---|---|---|
committer | Sean Griffin <sean@thoughtbot.com> | 2015-01-09 10:31:23 -0700 |
commit | ec475547a94315ac207ac4e9bd8f2ac04576230c (patch) | |
tree | 87f24db8b3928bfcc0d5f1bc8295d815459f70dc /activerecord/lib | |
parent | 13772bfa49325a8dc26410d2dcb555665a320f92 (diff) | |
download | rails-ec475547a94315ac207ac4e9bd8f2ac04576230c.tar.gz rails-ec475547a94315ac207ac4e9bd8f2ac04576230c.tar.bz2 rails-ec475547a94315ac207ac4e9bd8f2ac04576230c.zip |
Properly copy nested bind values from subqueried relations
This is cropping up all over the place. After a brief dive, I'm really
not sure why we have `arel.bind_values` at all. A cursory grep didn't
reveal where they're actually being assigned (it's definitely in AR, not
in Arel). I'd like to dig further into it, as I'm fairly certain we
don't actually need it, we just need a way for the predicate builder to
communicate merged binds upstream.
Fixes #18414
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/relation/query_methods.rb | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index f054e17017..d6e6cb4d05 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -1154,13 +1154,11 @@ module ActiveRecord end end - # This function is recursive just for better readablity. - # #where argument doesn't support more than one level nested hash in real world. def add_relations_to_bind_values(attributes) if attributes.is_a?(Hash) attributes.each_value do |value| if value.is_a?(ActiveRecord::Relation) - self.bind_values += value.bind_values + self.bind_values += value.arel.bind_values + value.bind_values else add_relations_to_bind_values(value) end |