title: Rails include only selected columns from relation
body: <p>I will try to explain:</p>
  
  <p>I have a table 'Product' and a table 'Store'. I'm trying to get just the store name to show at the page, but ActiveRecord is returning me all the columns from the store.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>@product = Product
            .order(id: :desc)
            .includes(:store)
            .select("products.id, products.store_id, stores.name")
            .limit(1)
  </code></pre>
  
  <p>The built query (from Rails):</p>
  
  <pre><code>Processing by IndexController#index as HTML
  Product Load (0.0ms)  SELECT  products.id, products.store_id FROM `products`  ORDER BY `products`.`id` DESC LIMIT 1
  Store Load (1.0ms)  SELECT `stores`.* FROM `stores` WHERE `stores`.`id` IN (111)
  </code></pre>
  
  <p>I just want to show the product's store name, but Rails is selecting all the store columns.</p>
  
  <p>My models:</p>
  
  <p>Product.rb</p>
  
  <pre><code>class Product &lt; ActiveRecord::Base
    belongs_to :store, :foreign_key =&gt; 'store_id'
  end
  </code></pre>
  
  <p>Store.rb:</p>
  
  <pre><code>class Loja &lt; ActiveRecord::Base
    has_many :products
  end
  </code></pre>
  
  <p>Any idea?</p>