diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-01-23 15:19:33 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-01-23 15:19:33 +0000 |
commit | 97849debf33123387d33ba11fa5cf776873a5e94 (patch) | |
tree | 4fe50bf70770464f74e5cf047dfdb146138a4fe4 /activerecord/lib/active_record | |
parent | d336ca5280523c4f4c9387d8a6778273469f856c (diff) | |
download | rails-97849debf33123387d33ba11fa5cf776873a5e94.tar.gz rails-97849debf33123387d33ba11fa5cf776873a5e94.tar.bz2 rails-97849debf33123387d33ba11fa5cf776873a5e94.zip |
Fixed that association proxies would fail === tests like PremiumSubscription === @account.subscription
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@476 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record')
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 5af24caeef..bae91da22d 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -598,6 +598,11 @@ module ActiveRecord #:nodoc: return result end + # Overwrite the default class equality method to provide support for association proxies. + def ===(object) + object.is_a?(self) + end + private # Finder methods must instantiate through this method to work with the single-table inheritance model # that makes it possible to create objects of different types from the same table. |