This project is archived and is in readonly mode.
ActiveRecord::Base#== is non-commutative when comparing a loaded versus initialized object
-
fritz
Followup: we've been using the following monkeypatch locally and it seems to work well. Note the restriction on nil ids.
module ActiveRecord class Base def ==(comparison_object) comparison_object.equal?(self) || (comparison_object.instance_of?(self.class) && comparison_object.id == id && !id.nil?) end end end -
CancelProfileIsBroken
- Tag changed from active_record, base, comparison, equality to active_record, base, bugmash, comparison, equality
-
Rizwan Reza
- Tag changed from active_record, base, bugmash, comparison, equality to active_record, base, comparison, equality
- State changed from new to resolved
This is fixed in 2-3-stable or 2.3.5.