Rails: create a relationship between comment and user
Don't think your question belongs to this code review section. You would have gotten help much faster if had posted in stackoverflow instead. Anyway there are couple points you need to check.


The CreateComments migration must have been updated (or at least there was another migration that changed the table) because the migration does not say anything about user_id column but the your model has that.
Since comment is a polymorphic association, I'm not sure if it should be connected to user via a belongs_to to user. You are confused between the polymorphic association relation and the user's relation of a comment. They are different, a comment belongs to a Question (or Post, Thread... that why you have polymorphic here) and also belongs to a user who created the comment. Even better, you can have another polymorphic association for commenter (I will skip it to avoid adding noise to your question)
Does this mean, I should create a foreign_key in the comments migration to a user? NO
How can I go about getting the creator of the comment from the comment itself? Something like @comment.creator or @comment.user? They are just methods rails generated for you after you setup the association, so yeah you can have whatever you want


Here is what I would do to get comment.commenter and comment.commenter= to work:

class Comment &lt; ApplicationRecord
  belongs_to :commentable, polymorphic: true
  belongs_to :commenter, class_name: 'User', foreign_key: 'user_id'
end