Permalink
Browse files

Use a set for the named scope methods not a big regexp.

  • Loading branch information...
1 parent db26b47 commit 99492bad885aa0ee44c770e2c61ad36c3058c697 @NZKoz NZKoz committed Aug 29, 2008
Showing with 2 additions and 2 deletions.
  1. +2 −2 activerecord/lib/active_record/named_scope.rb
@@ -101,9 +101,9 @@ def named_scope(name, options = {}, &block)
class Scope
attr_reader :proxy_scope, :proxy_options
-
+ NON_DELEGATE_METHODS = %w(nil? send object_id class extend find count sum average maximum minimum paginate first last empty? any? respond_to?).to_set
[].methods.each do |m|
- unless m =~ /(^__|^nil\?|^send|^object_id$|class|extend|^find$|count|sum|average|maximum|minimum|paginate|first|last|empty\?|any\?|respond_to\?)/
+ unless m =~ /^__/ || NON_DELEGATE_METHODS.include?(m)
delegate m, :to => :proxy_found
end
end

0 comments on commit 99492ba

Please sign in to comment.