aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2011-01-12 12:09:40 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2011-01-12 14:27:08 -0800
commit8bee98fe3a3917f86d53f68b7cc11c4aafe5f011 (patch)
tree9899ed23d575e8e354da0c7775bb5326515473dd /activerecord/lib/active_record/associations
parentc07961ee547720299ce6afb219beb0545ce7b310 (diff)
downloadrails-8bee98fe3a3917f86d53f68b7cc11c4aafe5f011.tar.gz
rails-8bee98fe3a3917f86d53f68b7cc11c4aafe5f011.tar.bz2
rails-8bee98fe3a3917f86d53f68b7cc11c4aafe5f011.zip
just use respond_to? and super rather than aliasing around methods
Diffstat (limited to 'activerecord/lib/active_record/associations')
-rw-r--r--activerecord/lib/active_record/associations/association_collection.rb2
-rw-r--r--activerecord/lib/active_record/associations/association_proxy.rb7
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 <tt>===</tt> 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