Hello im making an online retail store.
I made a mistake when creating items class.
I did
rails generate model Items title:string price:decimal description:text
I was suppose to do rails generate model Items title:string price:decimal description:text user:references
How do i add user:references without deleting my the migration file. So i will need another migration file which adds user:references?
I will also need to add a user_id index so create the new migration for user:references can i just add the following code to the migration?
add_index :Items, [:user_id, :created_at]
Thanks for any help :)
Aucun commentaire:
Enregistrer un commentaire