Codecast: Getting Started with Rails 7 07: Create Articles in the Application @StatelessCode
Codecast: Getting Started with Rails 7 07: Create Articles in the Application  @StatelessCode
Uploaded December 2021 | Updated September 2026, 3 weeks ago
This is the 7th video in the Getting Started with Rails 7 series. In this video Mike adds tests and implements the create and new methods for the Article resource, allowing for the creation of an Article record via the application. Following the guide, he first implements create with hardcoded values for the title and body attributes, then implements the new action with the form_with helper. After both of those are created, he uses strong parameters and wires up the form to create Article records dynamically.

This video covers:
00:00:10 Introduction
00:02:32 Add POST create test to ArticlesControllerTest
00:04:14 Add create action to ArticlesController and modify to make the test pass
00:06:27 Talk through guide explanation of the new action instantiating an instance of Article and create actually saving to the database
00:08:24 Invoke the create action from curl. Note: In the video we temporarily disable verify_authenticity_token in our local to demonstrate quickly. DO NOT do this in a real app!
00:11:21 Redirect vs. render in the create action
00:13:30 Write failing test for new action
00:15:16 Create the new action in the controller
00:16:06 Create blank new.html.erb. Test now failing instead of erroring
00:16:50 Review the new form builder and form_with method and add to view template
00:19:37 Look at the new action in the app. Test passing but create action still hardcoded
00:20:40 The requirement for strong parameters to allow only the attributes you specify
00:22:12 Modify the ArticlesControllerTest to use parameters
00:23:50 Add article_params private method to ArticlesController
00:25:32 Tests are passing. Create works in the application!
00:28:16 Commit and push the code

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 07: Create Articles in the ApplicationCodecast: Getting Started with Rails 7 03: Autoloading, Generate and Migrate a ModelUpgrade Sublime Text from Version 3 to 4 on UbuntuFix a Documentation Bug Referring to the Wrong ProjectWrite Devise System Tests for Password Change via FormInstall Visual Studio Code on Ubuntu 24.04The Path to Rails 8 -Remediate Code Coverage Issue Introduced by the 7.1 UpgradeRemove the Webdrivers Gem from a Rails 7 App and Update Selenium WebdriverCodecast: statelesscode.com WordPress 14: Add Finishing Touches and Launch the SiteCodecast: Getting Started with Rails 7 06: Resourceful Routes for Articles and the link_to HelperCodecast: Create a RubyGem 80: Refactor ConvenienceMethods - Part 2Codecast: Create a RubyGem 83: Ensure Adequate Commenting for ConvenienceMethods Module
Stateless Code |

Codecast: Getting Started with Rails 7 07: Create Articles in the Application

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER