aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-03-29 12:31:05 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-03-29 12:31:05 +0000
commit715715aed443a027fccbac995cd5404eaeabaf53 (patch)
tree3c8989822d5dda0d387674d70a6922c04ca8e76e /activerecord/lib/active_record/associations
parent37270359ac5a4e09eb3caff58963327bfb699460 (diff)
downloadrails-715715aed443a027fccbac995cd5404eaeabaf53.tar.gz
rails-715715aed443a027fccbac995cd5404eaeabaf53.tar.bz2
rails-715715aed443a027fccbac995cd5404eaeabaf53.zip
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
Diffstat (limited to 'activerecord/lib/active_record/associations')
-rw-r--r--activerecord/lib/active_record/associations/association_proxy.rb3
1 files changed, 1 insertions, 2 deletions
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?