how do I create a user_id column for mapping the id of one databse index to another?
I am aware of has_many & belongs_to, but I wan’t sure if I needed to specify user_id when creating the model …
rails g model User name:string email:string
rails g model Card inputA:string inputB:string — do I add user_id:integer ?
and then add has_many :cards, and belongs_to :user ?
or does rails automatically do this when you sue has_many and belongs_to
you add
user_id:integer, because the info is needed for the migration which is independent from the models.what you’ve proposed there is correct.