Codecast: Getting Started with Rails 7 04: Model CRUD in the Console and Listing Articles @StatelessCode
Codecast: Getting Started with Rails 7 04: Model CRUD in the Console and Listing Articles  @StatelessCode
Uploaded December 2021 | Updated November 2026, 3 hours ago
This is the 4th video in the Getting Started with Rails 7 series. In this video Mike explores the Rails console with the Article model and the ability to Create, Read, Update, and Destroy (CRUD) Article records in the console. After that he takes a quick look at the Rails database console, customizes some Rails fixtures, updates the controller test, and adds in the changes to the ArticlesController and index template to display a list of articles.

This video covers:
00:00:10 Introduction
00:01:17 Launch the Rails Console and explain the IRB REPL environment
00:02:43 Initialize and save an article
00:05:17 Update the article and save again
00:07:03 Add a second article using the Article.create method and change to length of Article.all
00:07:57 Assign an article to a variable with Article.find
00:09:25 Destroy an article that you don't want
00:11:24 Quick exploration of the Rails DB console (using SQLite3 in this case)
00:12:24 Modify the ArticlesController index action to query all articles and assign to an instance variable
00:14:12 Change the controller test to account for the upcoming changes in the index view
00:15:50 Make the fixtures less boring and validate in the Rails console for the test environment after fumbling around a bit
00:19:12 Modify the index.html.erb to make the tests pass and explain the template code
00:23:04 Talk through the ArticlesController index request-response cycle
00:24:08 Review, commit, and push code changes

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 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 EnhancementsExploring My Table Top Role-Playing User PersonaCreate a RubyGem 89: Add Ruby 3.2 to GitHub Actions and Update RSpec to a compatible versionAdd UUID Support and Generate the Devise User ModelAn INCONCEIVABLE Retrospective
Stateless Code |

Codecast: Getting Started with Rails 7 04: Model CRUD in the Console and Listing Articles

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER