Rails include only selected columns from relation
问题 I will try to explain: 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. Here is the code: @product = Product .order(id: :desc) .includes(:store) .select("products.id, products.store_id, stores.name") .limit(1) The built query (from Rails): Processing by IndexController#index as HTML Product Load (0.0ms) SELECT products.id, products.store_id FROM `products` ORDER BY