From 8bee98fe3a3917f86d53f68b7cc11c4aafe5f011 Mon Sep 17 00:00:00 2001 From: Aaron Patterson Date: Wed, 12 Jan 2011 12:09:40 -0800 Subject: just use respond_to? and super rather than aliasing around methods --- .../lib/active_record/associations/association_collection.rb | 2 +- activerecord/lib/active_record/associations/association_proxy.rb | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/activerecord/lib/active_record/associations/association_collection.rb b/activerecord/lib/active_record/associations/association_collection.rb index 3d8a23fdca..6433cc3034 100644 --- a/activerecord/lib/active_record/associations/association_collection.rb +++ b/activerecord/lib/active_record/associations/association_collection.rb @@ -329,7 +329,7 @@ module ActiveRecord loaded? ? @target.include?(record) : exists?(record) end - def proxy_respond_to?(method, include_private = false) + def respond_to?(method, include_private = false) super || @reflection.klass.respond_to?(method, include_private) end diff --git a/activerecord/lib/active_record/associations/association_proxy.rb b/activerecord/lib/active_record/associations/association_proxy.rb index e4a449d4f4..ba784fdb9d 100644 --- a/activerecord/lib/active_record/associations/association_proxy.rb +++ b/activerecord/lib/active_record/associations/association_proxy.rb @@ -50,10 +50,9 @@ module ActiveRecord # is computed directly through SQL and does not trigger by itself the # instantiation of the actual post records. class AssociationProxy #:nodoc: - alias_method :proxy_respond_to?, :respond_to? alias_method :proxy_extend, :extend delegate :to_param, :to => :proxy_target - instance_methods.each { |m| undef_method m unless m.to_s =~ /^(?:nil\?|send|object_id|to_a)$|^__|^respond_to_missing|proxy_/ } + instance_methods.each { |m| undef_method m unless m.to_s =~ /^(?:nil\?|send|object_id|to_a)$|^__|^respond_to|proxy_/ } def initialize(owner, reflection) @owner, @reflection = owner, reflection @@ -77,7 +76,7 @@ module ActiveRecord # Does the proxy or its \target respond to +symbol+? def respond_to?(*args) - proxy_respond_to?(*args) || (load_target && @target.respond_to?(*args)) + super || (load_target && @target.respond_to?(*args)) end # Forwards === explicitly to the \target because the instance method @@ -156,7 +155,7 @@ module ActiveRecord end def send(method, *args) - if proxy_respond_to?(method) + if respond_to?(method) super else load_target -- cgit v1.2.3