aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorRafael Mendonça França <rafaelmfranca@gmail.com>2014-04-04 13:31:10 -0300
committerRafael Mendonça França <rafaelmfranca@gmail.com>2014-04-04 13:31:10 -0300
commit5f1346b0c7cde53bb849dad89778c80ef1ed6571 (patch)
treebb54fe628c88cc9ec6385f2813734360cef087e2 /activerecord/test/cases
parentedb6f7db5495e6f683764e5bf5089cecab9cf7cd (diff)
parent1b187caaa1e1aa1bd0f440052b4df09a5ddaa4bf (diff)
downloadrails-5f1346b0c7cde53bb849dad89778c80ef1ed6571.tar.gz
rails-5f1346b0c7cde53bb849dad89778c80ef1ed6571.tar.bz2
rails-5f1346b0c7cde53bb849dad89778c80ef1ed6571.zip
Merge pull request #14562 from jefflai2/collection_proxy
CollectionProxy uses the arel of its association's scope. Conflicts: activerecord/CHANGELOG.md
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/relations_test.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb
index fddb7c204a..049c5a0606 100644
--- a/activerecord/test/cases/relations_test.rb
+++ b/activerecord/test/cases/relations_test.rb
@@ -573,6 +573,12 @@ class RelationTest < ActiveRecord::TestCase
assert_equal expected, actual
end
+ def test_to_sql_on_scoped_proxy
+ auth = Author.first
+ Post.where("1=1").written_by(auth)
+ assert_not auth.posts.to_sql.include?("1=1")
+ end
+
def test_loading_with_one_association_with_non_preload
posts = Post.eager_load(:last_comment).order('comments.id DESC')
post = posts.find { |p| p.id == 1 }