lib/toy/equality.rb in toystore-0.13.0 vs lib/toy/equality.rb in toystore-0.13.1
- old
+ new
@@ -1,25 +1,14 @@
module Toy
module Equality
extend ActiveSupport::Concern
def eql?(other)
- return true if self.class.eql?(other.class) && id == other.id
- return true if other.respond_to?(:target) &&
- self.class.eql?(other.target.class) &&
- id == other.target.id
- false
+ self.class.eql?(other.class) && attributes == other.attributes
end
- alias :== :eql?
+ alias_method :==, :eql?
- def equal?(other)
- if other.respond_to?(:proxy_respond_to?) && other.respond_to?(:target)
- other = other.target
- end
- super other
- end
-
def hash
- id.hash
+ attributes.hash
end
end
end