From b1b26af9a2f1c2037f7c2167d747ed33cc639763 Mon Sep 17 00:00:00 2001 From: Tim Morgan Date: Thu, 14 Oct 2010 22:31:05 -0500 Subject: Allow default_scope to accept a Proc. --- activerecord/lib/active_record/base.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'activerecord/lib/active_record') diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 78b3507dd9..879f02ff6a 100644 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1143,7 +1143,12 @@ MSG end def current_scoped_methods #:nodoc: - scoped_methods.last + method = scoped_methods.last + if method.respond_to?(:call) + unscoped(&method) + else + method + end end def reset_scoped_methods #:nodoc: -- cgit v1.2.3