diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2005-11-15 10:48:32 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2005-11-15 10:48:32 +0000 |
commit | 3441dfdb12d229ef07246a68ce1a775d77adf808 (patch) | |
tree | f6d99bca273c3bf09cb9580e8f3d282ba7f11327 /activerecord/lib | |
parent | 4f4aa4a13b69d85b6a91cf5e751d550f3d0e5a7a (diff) | |
download | rails-3441dfdb12d229ef07246a68ce1a775d77adf808.tar.gz rails-3441dfdb12d229ef07246a68ce1a775d77adf808.tar.bz2 rails-3441dfdb12d229ef07246a68ce1a775d77adf808.zip |
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
Diffstat (limited to 'activerecord/lib')
-rw-r--r-- | activerecord/lib/active_record/associations/association_proxy.rb | 17 |
1 files changed, 12 insertions, 5 deletions
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 |