diff --git a/lib/jsonapi/path_segment.rb b/lib/jsonapi/path_segment.rb index aa2d7805..c0bac653 100644 --- a/lib/jsonapi/path_segment.rb +++ b/lib/jsonapi/path_segment.rb @@ -30,7 +30,7 @@ def initialize(relationship:, resource_klass: nil) end def eql?(other) - relationship == other.relationship && resource_klass == other.resource_klass + other.is_a?(JSONAPI::PathSegment::Relationship) && relationship == other.relationship && resource_klass == other.resource_klass end def hash @@ -59,7 +59,7 @@ def initialize(resource_klass:, field_name:) end def eql?(other) - field_name == other.field_name && resource_klass == other.resource_klass + other.is_a?(JSONAPI::PathSegment::Field) && field_name == other.field_name && resource_klass == other.resource_klass end def delegated_field_name