In my rails 4 application, a client (clients table) can have many projects (projects table). I have a column called name
in each table. I am trying to write a
your query don't looses any thing. Actually you have applied join on models and you have written Project.joins(:client) that why it is looking like. means It will hold Project related data as it is and associated data hold with alias name that you have given 'client_name' in your query.
if you use
Project.joins(:client)
.select('projects.id project_id, projects.name projects_name,clients.name as client_name')
then it look like [#, #]
but it hold all the attribute that you selected.