diff options
author | Rick Olson <technoweenie@gmail.com> | 2008-02-14 07:24:09 +0000 |
---|---|---|
committer | Rick Olson <technoweenie@gmail.com> | 2008-02-14 07:24:09 +0000 |
commit | 8a2266c02063c1111c666c71ced7822f095ed56c (patch) | |
tree | 1420ac25830d4e1f8da1c1035369b703617f4ed0 /activerecord/lib/active_record/associations/association_proxy.rb | |
parent | dfa786631bb8476c8cae555ad8de5e83811dfe9d (diff) | |
download | rails-8a2266c02063c1111c666c71ced7822f095ed56c.tar.gz rails-8a2266c02063c1111c666c71ced7822f095ed56c.tar.bz2 rails-8a2266c02063c1111c666c71ced7822f095ed56c.zip |
Improve associations performance by avoiding named block arguments. Closes #11109
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8865 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record/associations/association_proxy.rb')
-rw-r--r-- | activerecord/lib/active_record/associations/association_proxy.rb | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/associations/association_proxy.rb b/activerecord/lib/active_record/associations/association_proxy.rb index 9fc0d44a01..2f9ba31786 100644 --- a/activerecord/lib/active_record/associations/association_proxy.rb +++ b/activerecord/lib/active_record/associations/association_proxy.rb @@ -77,6 +77,12 @@ module ActiveRecord @target.inspect end + def to_xml(options={}, &block) + if load_target + @target.to_xml(options, &block) + end + end + protected def dependent? @reflection.options[:dependent] @@ -120,9 +126,9 @@ module ActiveRecord end private - def method_missing(method, *args, &block) + def method_missing(method, *args) if load_target - @target.send(method, *args, &block) + @target.send(method, *args) { |*block_args| yield(*block_args) if block_given? } end end |