aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2015-03-24 08:00:59 -0300
committerCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2015-03-24 08:00:59 -0300
commitbfd5bf8313e6ea0bb2eccb68ee5076bb63f0b2db (patch)
tree132b23f4cab25c3571cb5528e4f3a04e72f9964d /activerecord/test
parent6a02efcfe560397a58fec53bd4ce177476f9cca7 (diff)
parentba057a5ebbf93283fc7d3f3f3ffdbae2f8c76fb7 (diff)
downloadrails-bfd5bf8313e6ea0bb2eccb68ee5076bb63f0b2db.tar.gz
rails-bfd5bf8313e6ea0bb2eccb68ee5076bb63f0b2db.tar.bz2
rails-bfd5bf8313e6ea0bb2eccb68ee5076bb63f0b2db.zip
Merge pull request #19452 from pinglamb/fix-referencing-wrong-alias-when-joining-tables-of-has-many-through-association
Fix referencing wrong aliases while joining tables of has many through association
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/calculations_test.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/activerecord/test/cases/calculations_test.rb b/activerecord/test/cases/calculations_test.rb
index f0393aa6b1..8fc996ee74 100644
--- a/activerecord/test/cases/calculations_test.rb
+++ b/activerecord/test/cases/calculations_test.rb
@@ -11,6 +11,10 @@ require 'models/minivan'
require 'models/speedometer'
require 'models/ship_part'
require 'models/treasure'
+require 'models/developer'
+require 'models/comment'
+require 'models/rating'
+require 'models/post'
class NumericData < ActiveRecord::Base
self.table_name = 'numeric_data'
@@ -636,4 +640,11 @@ class CalculationsTest < ActiveRecord::TestCase
Client.update_all(client_of: nil)
assert_equal({ nil => Client.count }, Client.group(:firm).count)
end
+
+ def test_should_reference_correct_aliases_while_joining_tables_of_has_many_through_association
+ assert_nothing_raised ActiveRecord::StatementInvalid do
+ developer = Developer.create!(name: 'developer')
+ developer.ratings.includes(comment: :post).where(posts: { id: 1 }).count
+ end
+ end
end