Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

STI should identify itself inside named_scope

[#1570 state:resovled]

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information...
commit 687d7f52c4a1d85666f1efc08ffa182e6dfeba57 1 parent cbf36cf
Paweł Kondzior authored josevalim committed
Showing with 5 additions and 1 deletion.
  1. +5 −1 activerecord/lib/active_record/named_scope.rb
View
6 activerecord/lib/active_record/named_scope.rb
@@ -89,7 +89,11 @@ def named_scope(name, options = {}, &block)
when Hash
options
when Proc
- options.call(*args)
+ if self.model_name != parent_scope.model_name
+ parent_scope.instance_exec(*args, &options)
+ else
+ options.call(*args)
+ end
end, &block)
end
(class << self; self end).instance_eval do
Please sign in to comment.
Something went wrong with that request. Please try again.