From 96b9fc44000e5f40ba463ff0e893db8c4fd33b85 Mon Sep 17 00:00:00 2001 From: Iain Hecker Date: Sat, 19 Mar 2011 21:53:49 +0100 Subject: Reapply extensions when using except and only --- activerecord/test/cases/relations_test.rb | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'activerecord/test/cases') diff --git a/activerecord/test/cases/relations_test.rb b/activerecord/test/cases/relations_test.rb index 00b7c26080..f0e483b6bc 100644 --- a/activerecord/test/cases/relations_test.rb +++ b/activerecord/test/cases/relations_test.rb @@ -797,6 +797,10 @@ class RelationTest < ActiveRecord::TestCase assert_equal Post.all, all_posts.all end + def test_extensions_with_except + assert_equal 2, Topic.named_extension.order(:author_name).except(:order).two + end + def test_only relation = Post.where(:author_id => 1).order('id ASC').limit(1) assert_equal [posts(:welcome)], relation.all @@ -808,6 +812,10 @@ class RelationTest < ActiveRecord::TestCase assert_equal Post.limit(1).all.first, all_posts.first end + def test_extensions_with_only + assert_equal 2, Topic.named_extension.order(:author_name).only(:order).two + end + def test_anonymous_extension relation = Post.where(:author_id => 1).order('id ASC').extending do def author -- cgit v1.2.3