aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/named_scope.rb
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2009-12-27 00:11:31 +0530
committerPratik Naik <pratiknaik@gmail.com>2009-12-27 00:11:31 +0530
commitf3741506981d8d4aafb28066f5a3a0509a4da846 (patch)
treee40919c45f5e6a0ffa8853b6eec4804c5c16df48 /activerecord/lib/active_record/named_scope.rb
parentc6258ee313653bc54e94e0008f1c098ed68aa3f4 (diff)
downloadrails-f3741506981d8d4aafb28066f5a3a0509a4da846.tar.gz
rails-f3741506981d8d4aafb28066f5a3a0509a4da846.tar.bz2
rails-f3741506981d8d4aafb28066f5a3a0509a4da846.zip
Ensure Model.scoped adds type conditions for STI models
Diffstat (limited to 'activerecord/lib/active_record/named_scope.rb')
-rw-r--r--activerecord/lib/active_record/named_scope.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/named_scope.rb b/activerecord/lib/active_record/named_scope.rb
index 38d54fa8ec..96d361093f 100644
--- a/activerecord/lib/active_record/named_scope.rb
+++ b/activerecord/lib/active_record/named_scope.rb
@@ -28,6 +28,7 @@ module ActiveRecord
else
if !scoped?(:find)
relation = arel_table
+ relation = relation.where(type_condition) if finder_needs_type_condition?
else
relation = construct_finder_arel
include_associations = scope(:find, :include)