@StatelessCode
  @StatelessCode
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.
Codecast: Getting Started with Rails 7 12: Add a Model and Route for CommentsCodecast: Create a RubyGem 85: Release Version 0.4.0!Codecast: Create a RubyGem 84: Update Docs and Extend ConvenienceMethods into NerdDice, MergeWrite System Tests for Devise Cancel My Account and Get Working With TurboStateless Code Video 204Codecast: statelesscode.com WordPress 04: Initial Push and Backlog SetupWrite Tests for User Locking and Unlocking and Finish the Devise EpicCodecast: statelesscode.com WordPress 06: Main Content Margins, YouTube Embeds, and EnlighterCodecast: statelesscode.com WordPress 08: Start on Sidebar and Footer and Use Tailwind DirectivesWhy Rails in the 2020s?Create a RubyGem 90: Fix README to Use Relative Links Instead of Absolute LinksCodecast: Getting Started with Rails 7 11: Use a Scaffold Generator to Quickly Produce a Resource

Codecast: Getting Started with Rails 7 12: Add a Model and Route for Comments @StatelessCode

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER