diff options
author | Sean Griffin <sean@seantheprogrammer.com> | 2015-01-05 17:09:23 -0700 |
---|---|---|
committer | Sean Griffin <sean@seantheprogrammer.com> | 2015-01-05 17:09:23 -0700 |
commit | 1ab7eba89b93135940bd4ec4d799e62cecbfd2ba (patch) | |
tree | 87b26dfc483f3a8009839e5d1ae1bad362d615b9 /activerecord/lib/active_record | |
parent | 00dad0343b3aa6cf019afe3c727d4a3d95ddc383 (diff) | |
parent | 42e386173f888c5762130db8db132bc33d739e4f (diff) | |
download | rails-1ab7eba89b93135940bd4ec4d799e62cecbfd2ba.tar.gz rails-1ab7eba89b93135940bd4ec4d799e62cecbfd2ba.tar.bz2 rails-1ab7eba89b93135940bd4ec4d799e62cecbfd2ba.zip |
Merge pull request #18350 from brainopia/fix_build_from_bind_values
Propagate bind_values from join in subquery
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/relation/query_methods.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/relation/query_methods.rb b/activerecord/lib/active_record/relation/query_methods.rb index 6892cc114c..f054e17017 100644 --- a/activerecord/lib/active_record/relation/query_methods.rb +++ b/activerecord/lib/active_record/relation/query_methods.rb @@ -745,6 +745,9 @@ module ActiveRecord def from!(value, subquery_name = nil) # :nodoc: self.from_value = [value, subquery_name] + if value.is_a? Relation + self.bind_values = value.arel.bind_values + value.bind_values + bind_values + end self end @@ -999,7 +1002,6 @@ module ActiveRecord case opts when Relation name ||= 'subquery' - self.bind_values = opts.bind_values + self.bind_values opts.arel.as(name.to_s) else opts |