From 3441dfdb12d229ef07246a68ce1a775d77adf808 Mon Sep 17 00:00:00 2001 From: Jeremy Kemper Date: Tue, 15 Nov 2005 10:48:32 +0000 Subject: Associations handle case-equality more consistently: item.parts.is_a?(Array) and item.parts === Array. Closes #1345. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3043 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- .../lib/active_record/associations/association_proxy.rb | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'activerecord/lib/active_record/associations') diff --git a/activerecord/lib/active_record/associations/association_proxy.rb b/activerecord/lib/active_record/associations/association_proxy.rb index 8245234854..17b8cc6446 100644 --- a/activerecord/lib/active_record/associations/association_proxy.rb +++ b/activerecord/lib/active_record/associations/association_proxy.rb @@ -17,13 +17,20 @@ module ActiveRecord reset end - def reload - reset + def respond_to?(symbol, include_priv = false) + proxy_respond_to?(symbol, include_priv) || (load_target && @target.respond_to?(symbol, include_priv)) + end + + # Explicitly proxy === because the instance method removal above + # doesn't catch it. + def ===(other) load_target + other === @target end - def respond_to?(symbol, include_priv = false) - proxy_respond_to?(symbol, include_priv) || (load_target && @target.respond_to?(symbol, include_priv)) + def reload + reset + load_target end def loaded? @@ -98,4 +105,4 @@ module ActiveRecord end end end -end \ No newline at end of file +end -- cgit v1.2.3