aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases
diff options
context:
space:
mode:
authorNeeraj Singh <neerajdotname@gmail.com>2010-05-03 12:18:25 -0400
committerJosé Valim <jose.valim@gmail.com>2010-05-15 09:48:49 +0200
commit58adc6737126242d189274d83c50bcade098800a (patch)
treede40fedc3fa29f49cc6af5c4109ca326c09bfedf /activerecord/test/cases
parentbcf5fea5e5a22edd5c7b27c29a53de0a4bedbc27 (diff)
downloadrails-58adc6737126242d189274d83c50bcade098800a.tar.gz
rails-58adc6737126242d189274d83c50bcade098800a.tar.bz2
rails-58adc6737126242d189274d83c50bcade098800a.zip
STI should not ignore type condition while applying scopes from parent class scopes
[#4507 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r--activerecord/test/cases/named_scope_test.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/activerecord/test/cases/named_scope_test.rb b/activerecord/test/cases/named_scope_test.rb
index e4cafad11e..9db0e7c143 100644
--- a/activerecord/test/cases/named_scope_test.rb
+++ b/activerecord/test/cases/named_scope_test.rb
@@ -142,6 +142,11 @@ class NamedScopeTest < ActiveRecord::TestCase
assert_equal authors(:david).posts & Post.containing_the_letter_a, authors(:david).posts.containing_the_letter_a
end
+ def test_named_scope_with_STI
+ assert_equal 3,Post.containing_the_letter_a.count
+ assert_equal 1,SpecialPost.containing_the_letter_a.count
+ end
+
def test_has_many_through_associations_have_access_to_named_scopes
assert_not_equal Comment.containing_the_letter_e, authors(:david).comments
assert !Comment.containing_the_letter_e.empty?