Answers for "using foreign keys with corresponding index on rails g migration"

0

rails g migration foreign key optionnal

#MODEL
belongs_to :author, optional: true

#MIGRATION
t.references :author, foreign_key: true
Posted by: Guest on February-04-2021

Code answers related to "using foreign keys with corresponding index on rails g migration"

Browse Popular Code Answers by Language