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

This commit is contained in:
Michael Koziarski
2008-08-29 21:12:37 +02:00
parent db26b47b9f
commit 99492bad88

View File

@@ -101,9 +101,9 @@ module ActiveRecord
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