lib/cistern/model.rb in cistern-0.9.0 vs lib/cistern/model.rb in cistern-0.9.1
- old
+ new
@@ -29,13 +29,23 @@
self
end
end
def ==(comparison_object)
- comparison_object.equal?(self) ||
+ super ||
(comparison_object.is_a?(self.class) &&
comparison_object.identity == self.identity &&
!comparison_object.new_record?)
+ end
+
+ alias :eql? :==
+
+ def hash
+ if self.identity
+ [self.class, self.identity].join(":").hash
+ else
+ super
+ end
end
def service
self.connection ? self.connection.class : Cistern
end