I need to print uniq results inside an array. To test this I need to insert an object inside my array.
array = [#<Card id: 394034, cards_config_id: nil>, #<Card id: 394033, cards_config_id: nil>, #<Card id: 394032, cards_config_id: nil>, #<Card id: 394035, cards_config_id: nil>]
I need to insert another Card
object to test uniqueness. Something like this array.uniq &:id
I know this is wrong but how can I achieve this ?
array << Card id:394034, cards_config_id: nil>
Aucun commentaire:
Enregistrer un commentaire