Skip to content

Getting Started with Rails 7 Episode 15: Prepare for Concerns

This is the 15th video in the Getting Started with Rails 7 series. In this video Mike provides an overview of modules, mixins, and concerns. Then he sets up a status field that has duplicated functionality between the Article and the Comment. In this episode he gets everything set up and working so that he can refactor it using ActiveSupport::Concern in the next video.

This video covers:

  • 00:00:10 Introduction and overview of concerns
  • 00:03:03 Generate and run migrations to add status field to both Article and Comment
  • 00:05:55 Add status field to strong parameters methods in controllers for articles and comments
  • 00:06:42 Add failing tests to article and comment model tests
  • 00:11:53 Add status functionality to article model
  • 00:13:21 Troubleshoot test failures. Update fixtures.
  • 00:18:01 Add status functionality to comment model
  • 00:19:10 Fix failing controller tests
  • 00:21:41 Add tests for the archived? method
  • 00:22:34 Add check for archived? to list views in articles index
  • 00:23:26 Backtrack and write failing controller tests for the change in view logic and then reintroduce functionality to make them pass
  • 00:25:42 Write failing test for articles controller show action and add an archived comment fixture
  • 00:26:52 Add check for archived? to comment partial for comment list in articles show
  • 00:27:40 Review, commit, and push code changes

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

Leave a Reply