mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Use a set for the named scope methods not a big regexp.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user