From 715715aed443a027fccbac995cd5404eaeabaf53 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 29 Mar 2005 12:31:05 +0000 Subject: Dont load the target before the proxy has had a chance to answer the respond_to? -- this would cause an .empty? query to trigger loading the entire collection if the proxy had already been initialized git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1036 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- activerecord/lib/active_record/associations/association_proxy.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/associations/association_proxy.rb b/activerecord/lib/active_record/associations/association_proxy.rb index 91da7dec4d..e32519537b 100644 --- a/activerecord/lib/active_record/associations/association_proxy.rb +++ b/activerecord/lib/active_record/associations/association_proxy.rb @@ -25,8 +25,7 @@ module ActiveRecord end def respond_to?(symbol, include_priv = false) - load_target - proxy_respond_to?(symbol, include_priv) || @target.respond_to?(symbol, include_priv) + proxy_respond_to?(symbol, include_priv) || (load_target && @target.respond_to?(symbol, include_priv)) end def loaded? -- cgit v1.2.3