Deduping an array in Ruby using the uniq method is simple.
1
| |
Deduping an array of objects based on a specific attibute can be more complicated.
Rails includes a uniq_by method.
1
| |
If you are working without Rails, the Hash works nicely since it allows only one instance of each key.
1 2 | |