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
Just tried something similar to this on my project. This should work:
@products = Product.
.order(id: :desc)
.joins(:store)
.select("products.id, products.store_id, stores.name")
.limit(1)
Using joins as opposed to includes will make rails perform only one query, because joins doesn't eager-load the association.