Getting Started with Rails 7 Episode 9: Update an Article and Use Form Partials

Article form partial in Visual Studio Code

This is the 9th video in the Getting Started with Rails 7 series. In this video Mike implements the edit and update actions, refactors repeated form code from the new and edit views into a form view partial, and refactors repeated code in the ArticlesControllerTest into shared assertion helper methods.

This video covers:

  • 00:00:10 Introduction
  • 00:01:21 Add failing tests for edit and update to ArticlesControllerTest
  • 00:06:01 Add edit and update actions to the controller
  • 00:09:00 Create edit.html.erb view file and add incrementally add code to get the tests passing.
  • 00:11:55 Refactor repeated form code in new and edit to _form.html.erb partial
  • 00:16:10 Demonstrate the refactored new and edit actions working in the application
  • 00:17:48 Add test and view code to include edit link in the show action
  • 00:19:45 Refactor ArticlesControllerTest to move repeated code to setup and private shared assertion helper methods
  • 00:26:58 Review, commit, and push code

The code for this series is open source and available on GitHub. View the commit for this video here.

, ,

Leave a Reply