Below is a relationship between Comments and a user. Each comment has one user so I’m building out a join in the code below.
I was wondering how to build this code to only include specific columns in the join. I don’t need all of the user information. Just the first_name. Any suggestions.
Current Code:
@comments = Comment.where(:study_id => @study.id).joins(:user)
You could use something like this: