Permalink
Browse files

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
  • Loading branch information...
1 parent 3727035 commit 715715aed443a027fccbac995cd5404eaeabaf53 @dhh dhh committed Mar 29, 2005
Showing with 1 addition and 2 deletions.
  1. +1 −2 activerecord/lib/active_record/associations/association_proxy.rb
@@ -25,8 +25,7 @@ def method_missing(symbol, *args, &block)
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?

0 comments on commit 715715a

Please sign in to comment.