aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2011-01-14 14:40:11 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2011-01-14 14:40:11 -0800
commitdc11a77ab7730ec213b5042e1261a7be8c211396 (patch)
tree33142eb3a3684de6c0ae1fcff2bf6ea5562d5930 /activerecord
parentef4ffed660015772f67826e8aaa319febe84f271 (diff)
downloadrails-dc11a77ab7730ec213b5042e1261a7be8c211396.tar.gz
rails-dc11a77ab7730ec213b5042e1261a7be8c211396.tar.bz2
rails-dc11a77ab7730ec213b5042e1261a7be8c211396.zip
write the delegate method directly to avoid `delegate` callstack overhead
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/associations/association_proxy.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/association_proxy.rb b/activerecord/lib/active_record/associations/association_proxy.rb
index b752f1fdc0..7f6e335858 100644
--- a/activerecord/lib/active_record/associations/association_proxy.rb
+++ b/activerecord/lib/active_record/associations/association_proxy.rb
@@ -51,7 +51,7 @@ module ActiveRecord
# instantiation of the actual post records.
class AssociationProxy #:nodoc:
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|proxy_/ }
def initialize(owner, reflection)
@@ -63,6 +63,10 @@ module ActiveRecord
construct_scope
end
+ def to_param
+ proxy_target.to_param
+ end
+
# Returns the owner of the proxy.
def proxy_owner
@owner