title: map in scope in active record
body: <p>I have a active record, where I have a usecase: I want to use <code>map</code> in the <code>ActiveRecord</code> <code>scopes</code>. Following is my code:</p>
  
  <pre><code>class SupportedGeoIdAndLocation &lt; ActiveRecord::Base
  
     scope :supported_geo_ids,            lambda { all.map(&amp;:geo_id).uniq }
     # also tried: scope :supported_geo_ids,            lambda { select('distinct geo_id').map(&amp;:geo_id).uniq }
     scope :locations_for_geo_id, lambda { |geo_id| where(:geo_id =&gt; geo_id).map(&amp;:location) }
  end
  </code></pre>
  
  <p>but when I do <code>SupportedGeoIdAndLocation.supported_geo_ids</code> I get empty array, while <code>SupportedGeoIdAndLocation.all.map(&amp;:geo_id).uniq</code> gives me desired result.</p>
  
  <p>I am looking for a way so that this can be done using lambda in one go, not via chaining of different methods and completely avoiding class functions.</p>
  
  <p>Looks like I am using scope in wrong way, Please suggest me what can be correct way.</p>
  
  <p>version: <code>padrino</code>:0.10.5, <code>ruby</code>: ruby-1.9.3-p429, <code>ActiveRecord</code>: 3.1.6</p>