From 97849debf33123387d33ba11fa5cf776873a5e94 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 23 Jan 2005 15:19:33 +0000 Subject: 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 --- activerecord/lib/active_record/base.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'activerecord/lib/active_record/base.rb') 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. -- cgit v1.2.3