Skip to content

Instantly share code, notes, and snippets.

@fcheung
Created January 1, 2009 21:56
Show Gist options
  • Save fcheung/42383 to your computer and use it in GitHub Desktop.
Save fcheung/42383 to your computer and use it in GitHub Desktop.
diff --git a/activerecord/lib/active_record/named_scope.rb b/activerecord/lib/active_record/named_scope.rb
index 83043c2..8c2507e 100644
--- a/activerecord/lib/active_record/named_scope.rb
+++ b/activerecord/lib/active_record/named_scope.rb
@@ -93,7 +93,11 @@ module ActiveRecord
end
(class << self; self end).instance_eval do
define_method name do |*args|
- scopes[name].call(self, *args)
+ if scoped? :find
+ scopes[name].call(Scope.new(self, scope(:find)), *args)
+ else
+ scopes[name].call(self, *args)
+ end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment