• Skip to primary navigation
  • Skip to main content
  • Skip to footer
Code The Dream School
Code the Dream Labs Logo

Code The Dream School

Main hub for class materials for Code the Dream’s classes

  • Code the Dream Home

Search Code The Dream School

Rails Validations, Error Handling, Byebug, Rspec Testing

The Treehouse videos cover many of the aspects of Rails development, but some key skills are not covered. In this week, we fill in the gaps. There are no videos for these lessons, but there are two slide sets linked here, one covering validation and other topics, and one covering testing with rspec. Please complete both this week.

Validations, Error Handling, Alert Messages, Byebug

Validations may be performed by Active Record model classes. They check to ensure that when a new or updated instance of the model object is stored, that it has values for fields that are needed, instead of blanks and that the fields are syntactically correct.

Error Handling is additional code to handle error conditions, such as validations failing and exceptions.

Alert messages convey status to the user. They are shown on the next screen only.

Byebug provides a means to debug Rails applications. It stops the server at the point where the byebug instruction is reached. At that point, the Rails server provides a command line, allowing not only byebug commands, but also the commands that one can do in the rails console, where one can check the values of variables and the state of the database.

This lesson also describes more briefly the use of layouts, exception handling, logging, stylesheets, and adding additional methods to model classes.

You will be adding additional capabilities to the blog application. As before, you should take time to make the changes described.

Rspec

Rspec is a testing framework for rails. It is important to write automated tests for each of the capabilities of the application. This is a brief introduction to rspec. The code for some of the tests is provided in the slides, and you should complete the assignment to add additional tests. Again, you will be extending the blog application.

Be sure you push your updated code to github. Also, be sure you attend several mentor sessions, as this week is challenging.

Footer

Copyright © 2025 Code the Dream School | All Rights Reserved | Privacy Policy