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/test | |
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/test')
-rw-r--r-- | activerecord/test/cases/bind_parameter_test.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/activerecord/test/cases/bind_parameter_test.rb b/activerecord/test/cases/bind_parameter_test.rb index c4634d11e2..66663b3e0e 100644 --- a/activerecord/test/cases/bind_parameter_test.rb +++ b/activerecord/test/cases/bind_parameter_test.rb @@ -1,9 +1,11 @@ require 'cases/helper' require 'models/topic' +require 'models/author' +require 'models/post' module ActiveRecord class BindParameterTest < ActiveRecord::TestCase - fixtures :topics + fixtures :topics, :authors, :posts class LogListener attr_accessor :calls @@ -30,6 +32,12 @@ module ActiveRecord end if ActiveRecord::Base.connection.supports_statement_cache? + def test_bind_from_join_in_subquery + subquery = Author.joins(:thinking_posts).where(name: 'David') + scope = Author.from(subquery, 'authors').where(id: 1) + assert_equal 1, scope.count + end + def test_binds_are_logged sub = @connection.substitute_at(@pk) binds = [[@pk, 1]] |