Stateless Code | Codecast: Getting Started with Rails 7 12: Add a Model and Route for Comments @StatelessCode | Uploaded January 2022 | Updated October 2024, 4 hours ago.
This is the 12th video in the Getting Started with Rails 7 series. In this video Mike uses the Rails model generator to generate a model for comments on articles. He reviews the generated code, tweaks a couple of associations, customizes the fixtures, adds a nested route for comments. At the end, he re-runs the test suite and fixes a newly failing test due to the foreign key constraint in the comments table.
This video covers:
00:00:10 Introduction
00:02:13 Generate the Comment model in the terminal and review
00:03:29 Review and modify the fixture to be more interesting and have referential integrity
00:05:56 Review and run the migration and changes to schema.rb
00:08:21 Review associations and add has_many to Article model
00:11:31 Add a nested resource for comments to routes file and review
00:14:34 Show what would happen if comments resource was not nested and then revert
00:16:04 Add dependent: :destroy to has_many association to fix foreign key constraint test failure
00:19:07 Review, commit, and push
This video is CC0 - No rights reserved. (YouTube doesn't allow this option when publishing.) All code is released under the UNLICENSE. Stateless Code denies the concept of "intellectual property". Copying is not stealing.
This is the 12th video in the Getting Started with Rails 7 series. In this video Mike uses the Rails model generator to generate a model for comments on articles. He reviews the generated code, tweaks a couple of associations, customizes the fixtures, adds a nested route for comments. At the end, he re-runs the test suite and fixes a newly failing test due to the foreign key constraint in the comments table.
This video covers:
00:00:10 Introduction
00:02:13 Generate the Comment model in the terminal and review
00:03:29 Review and modify the fixture to be more interesting and have referential integrity
00:05:56 Review and run the migration and changes to schema.rb
00:08:21 Review associations and add has_many to Article model
00:11:31 Add a nested resource for comments to routes file and review
00:14:34 Show what would happen if comments resource was not nested and then revert
00:16:04 Add dependent: :destroy to has_many association to fix foreign key constraint test failure
00:19:07 Review, commit, and push
This video is CC0 - No rights reserved. (YouTube doesn't allow this option when publishing.) All code is released under the UNLICENSE. Stateless Code denies the concept of "intellectual property". Copying is not stealing.