diff options
author | Michael Koziarski <michael@koziarski.com> | 2008-08-29 21:12:37 +0200 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2008-08-29 21:12:37 +0200 |
commit | 99492bad885aa0ee44c770e2c61ad36c3058c697 (patch) | |
tree | 0c8edbd84600ffe13330f0ac2e7826c90335b2de | |
parent | db26b47b9f4dbebd478a5fe6c0dcd38b8697939a (diff) | |
download | rails-99492bad885aa0ee44c770e2c61ad36c3058c697.tar.gz rails-99492bad885aa0ee44c770e2c61ad36c3058c697.tar.bz2 rails-99492bad885aa0ee44c770e2c61ad36c3058c697.zip |
Use a set for the named scope methods not a big regexp.
-rw-r--r-- | activerecord/lib/active_record/named_scope.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/named_scope.rb b/activerecord/lib/active_record/named_scope.rb index b9b7eb5f00..570416d4e0 100644 --- a/activerecord/lib/active_record/named_scope.rb +++ b/activerecord/lib/active_record/named_scope.rb @@ -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 |