Skip to content

Duplicate elements in a collection are removed #22

Open
@hiroshinakasone0

Description

@hiroshinakasone0

Steps to reproduce

item1 = Item.new(id: 1, name: 'Item1')
item2 = Item.new(id: 2, name: 'Item2')
item3 = Item.new(id: 3, name: 'Item3')
items = [item1, item2, item1, item3]

json.cache_collection! items do |item|
  json.id item.id
  json.name item.name
end

Expected results

[
  { "id": 1, "name": "Item1"},
  { "id": 2, "name": "Item2"},
  { "id": 1, "name": "Item1"},
  { "id": 3, "name": "Item3"}
]

Actual results

[
  { "id": 1, "name": "Item1"},
  { "id": 2, "name": "Item2"},
  { "id": 3, "name": "Item3"}
]

Environment

Ruby: 2.3.4
Rails: 5.0.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions