title: find_by_sql in Rails, accessing the resulting array
body: <p>I'm trying to run a query in a very quick and dirty way in Rails, without putting the rest of the model in place.  I know this is bad practice but I just need a quick result in a tight timeframe until I've got the whole solution in place.</p>
  
  <p>I've got items that have a shipping price, based on weight.  The weight is stored in the item, the price is stored in the table shipping_zone_prices, and all I currently do is look for the price relating to the first row where the weight is heavier than the item for sale:</p>
  
  <pre><code>class Item &lt; ActiveRecord::Base
    def shipping_price
      item_id = self.id
      shipping_price = ShippingZonePrice.find_by_sql(
        "SELECT z.price as price
         FROM shipping_zone_prices z, items i
         WHERE i.id = '#{item_id}'
         AND z.weight_g &gt; d.weight
         ORDER BY z.weight_g asc limit 1")    
    end
  end
  </code></pre>
  
  <p>This sort of works.  The SQL does the job, but when plugged into the app as follows:</p>
  
  <pre><code> &lt;%= @item.shipping_price %&gt; Shipping
  </code></pre>
  
  <p>I get the following displayed:</p>
  
  <pre><code>[#&lt;ShippingZonePrice price: 12&gt;] Shipping
  </code></pre>
  
  <p>In this example, '12' is the price that is being pulled from the db, and is correct.  @item.shipping_price.class returns 'Array'.  Trying to access the array using [0] (or any other integer) returns a blank.</p>
  
  <p>Is there another way to access this, or am I missing something fundamental?</p>