Codecast: Getting Started with Rails 7 11: Use a Scaffold Generator to Quickly Produce a Resource @StatelessCode
Codecast: Getting Started with Rails 7 11: Use a Scaffold Generator to Quickly Produce a Resource  @StatelessCode
Uploaded December 2021 | Updated September 2026, 2 weeks ago
"Do you mean to tell me that we could have done all the work from the previous ten videos in half an hour?!"

Yes. (But the purpose of the Getting Started with Rails guide is education, so it slowed things down, added them in incrementally, and explained them.)

This is the 11th video in the Getting Started with Rails 7 series. In this video Mike deviates from the guide temporarily to show an alternate way to quickly produce a Rails resource using the Rails scaffold generator. By using the command `rails g scaffold Post title:string body:text` we get a full equivalent resource with a route, model, controller, views, and generated tests. Once you gain familiarity with how Ruby on Rails works, this will likely be the most frequent way you create resources.

This video covers:
00:00:10 Introduction and review previous episodes
00:02:30 Use the scaffold generator to create the roughly equivalent Post resource inspect terminal output
00:03:59 Review and compare generated scaffold files to existing Article files
00:06:12 Incorporate before_action callback into the existing ArticlesController
00:08:12 Run tests to see current state and fix bad fixture names
00:10:25 Review posts resource in the application
00:11:16 Adapt model and system tests for validations and Turbo confirm
00:15:46 Get tests passing with Turbo and destroy confirmation
00:24:04 Experiment with ArticlesControllerTest and notice. Revert.
00:28:40 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 11: Use a Scaffold Generator to Quickly Produce a ResourceMike From the Future Saves Your Docker SetupUpdate Rails to 7.0.4 and Update the BundleProfessional Level Performance of 433 by John CageCodecast: Getting Started with Rails 7 04: Model CRUD in the Console and Listing ArticlesCodecast: statelesscode.com WordPress 23: Finish Styling Comments Except for FormWrite Browser Tests for Devise Sign UpSet up a GitHub Profile README for an OrganizationCodecast: statelesscode.com WordPress 11: Backlog priority, and Footer Link StylingCodecast: statelesscode.com WordPress 16: Move the Footer Widget Back to the FooterMediocre Karaoke - Better Now by Collective SoulThe Path to Rails 8 - Update the GitHub Actions to include Rails 8 Enhancements
Stateless Code |

Codecast: Getting Started with Rails 7 11: Use a Scaffold Generator to Quickly Produce a Resource

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER