I’m trying to select just one column for many records in a table. This does not produce what I’m looking for. The SQL equivalent of what I’m trying to produce is:
SELECT OneColumn FROM Table WHERE ForeignKey = 1
I’ve tried many of the suggestions in the Rails Guide for Active Record, but none have worked.
from rails 3.2+ you have #pluck :
if you have troubles due to non-conventionnal column or table names, try :
If you just want “low-level” SQL queries, try #select_all or #select_values