aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2011-12-18 09:35:06 -0800
committerJon Leighton <j@jonathanleighton.com>2011-12-18 09:35:06 -0800
commit81c67c1441c5aa86c92b5db87cbbc7ca1cbd8a44 (patch)
tree4a6ff17736ab46b6f90097480dec2f4a2a928943 /activerecord/lib/active_record
parent1214e16640cb193747f3181f1f6a795140a0c902 (diff)
parent04cea56d89e71dbb25dc888d8f855ba18025ccca (diff)
downloadrails-81c67c1441c5aa86c92b5db87cbbc7ca1cbd8a44.tar.gz
rails-81c67c1441c5aa86c92b5db87cbbc7ca1cbd8a44.tar.bz2
rails-81c67c1441c5aa86c92b5db87cbbc7ca1cbd8a44.zip
Merge pull request #4011 from lest/scope-with-lambda-duplicates
call scope within unscoped to prevent duplication of where values
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/scoping/named.rb2
1 files changed, 1 insertions, 1 deletions
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)