Uniq by object attribute in Ruby December 2, 2022 by Tarik Use Array#uniq with a block: @photos = @photos.uniq { |p| p.album_id }