diff options
author | Jon Leighton <j@jonathanleighton.com> | 2012-01-14 17:53:52 +0000 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2012-01-16 21:17:17 +0000 |
commit | ee7f66603573fd441f1522cc73ec0b7f56c4d1af (patch) | |
tree | 5eb727b65af37d296425bfbb0412786d55d01e10 /activerecord/test | |
parent | 4429f16c0ada896fe3753324f0201b290c6425d9 (diff) | |
download | rails-ee7f66603573fd441f1522cc73ec0b7f56c4d1af.tar.gz rails-ee7f66603573fd441f1522cc73ec0b7f56c4d1af.tar.bz2 rails-ee7f66603573fd441f1522cc73ec0b7f56c4d1af.zip |
automatically add references when we can
Diffstat (limited to 'activerecord/test')
-rw-r--r-- | activerecord/test/cases/relations_test.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index c089ed164c..a652a52f38 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -1175,4 +1175,18 @@ class RelationTest < ActiveRecord::TestCase scope = Post.references(:comments) assert !scope.eager_loading? end + + def test_automatically_added_references + scope = Post.where(:comments => { :body => "Bla" }) + assert_equal [:comments], scope.references_values + + scope = Post.where('comments.body' => 'Bla') + assert_equal [:comments], scope.references_values + + scope = Post.having(:comments => { :body => "Bla" }) + assert_equal [:comments], scope.references_values + + scope = Post.having('comments.body' => 'Bla') + assert_equal [:comments], scope.references_values + end end |