Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate elements in a collection are removed #22

Open
hiroshinakasone0 opened this issue Mar 2, 2019 · 0 comments
Open

Duplicate elements in a collection are removed #22

hiroshinakasone0 opened this issue Mar 2, 2019 · 0 comments

Comments

@hiroshinakasone0
Copy link

hiroshinakasone0 commented Mar 2, 2019

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant