I have a User and a Question model, User has_many questions and Question
On my question show page, I show a question, along with the name of the
user who’s asking the question.
Everything seems to be working fine, but my controller looks like this:
@question = Question.find(params[:id])
@user = User.find(@question.user_id)
I know rails must have a less messy way to figure out which user the
question belongs to. I’ve read that using something like question.user
would give me what I need, but I can’t figure out how to implement it in
Sorry for the simple question, any suggestions are appreciated. Thanks!