ruby on rails - How to write foreign keys in many-to-many rich join? -
I am trying to include several rich people with the table joining in the AdminUser and SectionEdit . This model has been created by producing. Create inside_section_edits, we write
create_table: section_edits do | T | T.integer: admin_user_id t.integer: section_id t.timestamps t.string: summary end Any difference in using : admin_user_id and Is "admin_user_id" ? The same goes for the second primary key, the Admin_user_id is the foreign key.
No, but better practice is to use symbol : admin_user_id As an alternative idea:
create_table: section_edits do | T | T.references: admin_user, index: true t.references: clause, index: true t.string: summarize t.temestamps end In this way, note that you can add foreign key index index: true context:
Comments
Post a Comment