Stateless Code | Codecast: Getting Started with Rails 7 26: Fix Rich Text Fixtures and Validations @StatelessCode | Uploaded February 2022 | Updated October 2024, 1 hour ago.
This is the 26th video in the Getting Started with Rails 7 series. In this video Mike fixes some errors from the Use ActionText for Rich Text Content video (episode 24).
The two main fixes are
* The rich_texts.yml fixture had the wrong value for all of the name attributes. It should be the name of the rich text field on the record.
* The validations were removed in the previous video. You can still have validation on rich text fields. You just need to validate with a custom method.
This video covers:
00:00:10 Introduction. Review the bugs.
00:00:40 Fix the fixtures to use the correct field name attribute and check on tests
00:08:53 Restore the validation tests that were removed in the previous video
00:10:17 Add body presence validation back into the Article model
00:11:58 Write custom method to validate length of the rich text body
00:16:55 Refactor body validations into a concern and apply it to the Comment and Article models
00:22:46 Create testing support concern for body validation tests
00:36:15 Test in the browser. Doesn't work if comment is invalid because we don't have an unhappy path in the CommentsController.
00:39:35 Implement functionality for if comment fails validation
00:52:18 Review, commit, and push 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.
This is the 26th video in the Getting Started with Rails 7 series. In this video Mike fixes some errors from the Use ActionText for Rich Text Content video (episode 24).
The two main fixes are
* The rich_texts.yml fixture had the wrong value for all of the name attributes. It should be the name of the rich text field on the record.
* The validations were removed in the previous video. You can still have validation on rich text fields. You just need to validate with a custom method.
This video covers:
00:00:10 Introduction. Review the bugs.
00:00:40 Fix the fixtures to use the correct field name attribute and check on tests
00:08:53 Restore the validation tests that were removed in the previous video
00:10:17 Add body presence validation back into the Article model
00:11:58 Write custom method to validate length of the rich text body
00:16:55 Refactor body validations into a concern and apply it to the Comment and Article models
00:22:46 Create testing support concern for body validation tests
00:36:15 Test in the browser. Doesn't work if comment is invalid because we don't have an unhappy path in the CommentsController.
00:39:35 Implement functionality for if comment fails validation
00:52:18 Review, commit, and push 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.