How to test for (ActiveRecord) object equality

前端 未结 6 1293
礼貌的吻别
礼貌的吻别 2020-11-29 05:55

In Ruby 1.9.2 on Rails 3.0.3, I\'m attempting to test for object equality between two Friend (class inherits from ActiveRecord::

6条回答
  •  心在旅途
    2020-11-29 06:10

    Rails deliberately delegates equality checks to the identity column. If you want to know if two AR objects contain the same stuff, compare the result of calling #attributes on both.

提交回复
热议问题