Need to create a foreign key when creating a table on Rails?

前端 未结 2 1854
忘了有多久
忘了有多久 2021-01-02 12:13

i\'m starting now on Rails, i looked in the forum, but i didn\'t find anything that could solve my problem.

Here it goes, I have a Category table, and it has only n

2条回答
  •  北海茫月
    2021-01-02 12:36

    There are many valid reasons to have foreign keys in your database. See Does Rails need database-level constraints?

    I recommend Foreigner if you want to easily add foreign keys to your Rails app.

提交回复
热议问题