From 04cea56d89e71dbb25dc888d8f855ba18025ccca Mon Sep 17 00:00:00 2001 From: Sergey Nartimov Date: Sat, 17 Dec 2011 14:41:17 +0300 Subject: call scope within unscoped to prevent duplication of where values --- activerecord/lib/active_record/scoping/named.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/scoping/named.rb b/activerecord/lib/active_record/scoping/named.rb index f7512bbf5f..17122740da 100644 --- a/activerecord/lib/active_record/scoping/named.rb +++ b/activerecord/lib/active_record/scoping/named.rb @@ -177,7 +177,7 @@ module ActiveRecord extension = Module.new(&Proc.new) if block_given? scope_proc = lambda do |*args| - options = scope_options.respond_to?(:call) ? scope_options.call(*args) : scope_options + options = scope_options.respond_to?(:call) ? unscoped { scope_options.call(*args) } : scope_options options = scoped.apply_finder_options(options) if options.is_a?(Hash) relation = scoped.merge(options) -- cgit v1.2.3