title: Efficient way to convert collection to array of hashes for render json
body: <p>Is there a more efficient way to map a collection of objects to an array of hashes?</p>
  
  <pre><code>def list
    @photos = []
    current_user.photos.each do |p|
      @photos &lt;&lt; {
        id: p.id, label: p.name, url: p.uploaded_image.url(:small),
        size: p.uploaded_image_file_size
      }
    end
    render json: { results: @photos }.to_json
  end
  </code></pre>
  
  <p>This seems a bit verbose but the structure it returns is required by the frontend.</p>
  
  <p><strong>Update</strong></p>
  
  <p>So <code>.map</code> is the preferred method then?</p>