I have a User
model and a Question
model.
I want to add a belongs_to :user
association to the Question
model, but I want that association to be called author
. For example, I would call question.author
rather than question.user
.
Obviously this requires two steps:
- The association in the models/question.rb
- The migration (note both the user and question tables already exist)
Surprisingly I haven't found the single, conventional method of doing this in Rails 5 in a different answer.
How do I do this?
bin/rails ...
,rails ...
, andrake ...
? – Neve