aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
authorSantiago Pastorino <santiago@wyeworks.com>2010-11-16 12:36:47 -0200
committerSantiago Pastorino <santiago@wyeworks.com>2010-11-16 12:40:40 -0200
commit4718d097ffe3af965f3ea7218156050507eabe4f (patch)
tree3e4435fb38bc4edd1d349c0aad4ed8cfa64aff05 /activerecord/lib
parentdff0dfb7f80199e8f13dd20b39e0bc6b79438863 (diff)
downloadrails-4718d097ffe3af965f3ea7218156050507eabe4f.tar.gz
rails-4718d097ffe3af965f3ea7218156050507eabe4f.tar.bz2
rails-4718d097ffe3af965f3ea7218156050507eabe4f.zip
Models should be equals even after destroyed
[#5978 state:committed]
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/base.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb
index f588475bbf..658c6d7b45 100644
--- a/activerecord/lib/active_record/base.rb
+++ b/activerecord/lib/active_record/base.rb
@@ -1585,9 +1585,9 @@ MSG
# Returns true if the +comparison_object+ is the same object, or is of the same type and has the same id.
def ==(comparison_object)
comparison_object.equal?(self) ||
- persisted? &&
- (comparison_object.instance_of?(self.class) &&
- comparison_object.id == id)
+ comparison_object.instance_of?(self.class) &&
+ id.present? &&
+ comparison_object.id == id
end
# Delegates to ==