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
You could use something like this:
@comments = Comment.joins(:user) .select("comments.*, users.first_name") .where(study_id: @study.id)