Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

  • Loading branch information...
commit 99492bad885aa0ee44c770e2c61ad36c3058c697 1 parent db26b47
@NZKoz NZKoz authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 activerecord/lib/active_record/named_scope.rb
View
4 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
Please sign in to comment.
Something went wrong with that request. Please try again.