Use a Set for managing uniqueness behavior
This commit is contained in:
parent
a4bd5a1edc
commit
e2ac01f98a
@ -80,7 +80,7 @@ module FastJsonapi
|
||||
|
||||
return if options.blank?
|
||||
|
||||
@known_included_objects = {}
|
||||
@known_included_objects = Set.new
|
||||
@meta = options[:meta]
|
||||
@links = options[:links]
|
||||
@is_collection = options[:is_collection]
|
||||
|
||||
@ -133,9 +133,9 @@ module FastJsonapi
|
||||
end
|
||||
|
||||
code = "#{record_type}_#{serializer.id_from_record(inc_obj, params)}"
|
||||
next if known_included_objects.key?(code)
|
||||
next if known_included_objects.include?(code)
|
||||
|
||||
known_included_objects[code] = inc_obj
|
||||
known_included_objects << code
|
||||
|
||||
included_records << serializer.record_hash(inc_obj, fieldsets[record_type], includes_list, params)
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user