Skip to content

Commit

Permalink
STI should identify itself inside named_scope
Browse files Browse the repository at this point in the history
[#1570 state:resovled]

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information
Paweł Kondzior authored and josevalim committed Jun 23, 2010
1 parent cbf36cf commit 687d7f5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion activerecord/lib/active_record/named_scope.rb
Expand Up @@ -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
Expand Down

0 comments on commit 687d7f5

Please sign in to comment.