title: Uniq of ruby array fails to work
body: <p>I have a array of my object Country which has the attributes "code" and "name"</p>
  
  <p>The array could have a country in it more than once so I want to distinct the array.</p>
  
  <p>This is my countries class</p>
  
  <pre><code>class Country
    include Mongoid::Fields::Serializable
    attr_accessor :name, :code
  
    FILTERS = ["Afghanistan","Brunei","Iran", "Kuwait", "Libya", "Saudi Arabia", "Sudan", "Yemen", "Britain (UK)", "Antarctica", "Bonaire Sint Eustatius &amp; Saba", "British Indian Ocean Territory", "Cocos (Keeling) Islands", "St Barthelemy", "St Martin (French part)", "Svalbard &amp; Jan Mayen","Vatican City"]
  
    EXTRAS = {
      'eng' =&gt; 'England',
      'wal' =&gt; 'Wales',
      'sco' =&gt; 'Scotland',
      'nlr' =&gt; 'Northern Ireland'
      }
  
    def initialize(name, code)
      @name = name
      @code = code
    end
  
    def deserialize(object)
      return nil unless object
      Country.new(object['name'], object['code'])
    end
  
    def serialize(country)
      {:name =&gt; country.name, :code =&gt; country.code}
    end
  
    def self.all
      add_extras(filter(TZInfo::Country.all.map{|country| to_country country})).sort! {|c1, c2| c1.name &lt;=&gt; c2.name}
    end
  
    def self.get(code)
      begin
        to_country TZInfo::Country.get(code)
      rescue TZInfo::InvalidCountryCode =&gt; e
        'InvalidCountryCode' unless EXTRAS.has_key? code
        Country.new EXTRAS[code], code
      end
    end
  
    def self.get_by_name(name)
      all.select {|country| country.name.downcase == name.downcase}.first
    end
  
    def self.filter(countries)
      countries.reject {|country| FILTERS.include?(country.name)}
    end
  
    def self.add_extras(countries)
      countries + EXTRAS.map{|k,v| Country.new v, k}
    end
  
    private
    def self.to_country(country)
      Country.new country.name, country.code
    end
  end
  </code></pre>
  
  <p>and my request for the array which is called from another class</p>
  
  <pre><code>  def countries_ive_drunk
      (had_drinks.map {|drink| drink.beer.country }).uniq
    end
  </code></pre>
  
  <p>If I throw the array I can see the structure is:</p>
  
  <pre><code>[
  #&lt;Country:0x5e3b4c8 @name="Belarus", @code="BY"&gt;, 
  #&lt;Country:0x5e396e0 @name="Britain (UK)", @code="GB"&gt;, 
  #&lt;Country:0x5e3f350 @name="Czech Republic", @code="CZ"&gt;, 
  #&lt;Country:0x5e3d730 @name="Germany", @code="DE"&gt;, 
  #&lt;Country:0x5e43778 @name="United States", @code="US"&gt;, 
  #&lt;Country:0x5e42398 @name="England", @code="eng"&gt;, 
  #&lt;Country:0x5e40f70 @name="Aaland Islands", @code="AX"&gt;, 
  #&lt;Country:0x5e47978 @name="England", @code="eng"&gt;, 
  #&lt;Country:0x5e46358 @name="Portugal", @code="PT"&gt;, 
  #&lt;Country:0x5e44d38 @name="Georgia", @code="GE"&gt;, 
  #&lt;Country:0x5e4b668 @name="Germany", @code="DE"&gt;, 
  #&lt;Country:0x5e4a2a0 @name="Anguilla", @code="AI"&gt;, 
  #&lt;Country:0x5e48c98 @name="Anguilla", @code="AI"&gt;
  ]
  </code></pre>
  
  <p>This is the same, whether or not I do .uniq and you can see there is two "Anguilla"</p>