• Online, Self-Paced
Course Description

Rails is a web application framework that provides default structures for a database, a web service, and web pages. Rails lets you write code by favoring convention over configuration. In this course, you will learn how to work with the ActiveRecord, perform validations, and work with virtual models including model callbacks.

Learning Objectives

ActiveRecord Basics

  • start the course
  • describe the basics of how ActiveRecord works
  • use has_one, has_many, and belongs_to associations
  • use the :through association
  • make one class belongs_to more than one type of another class
  • use virtual attributes
  • persist data into multiple models
  • describe Hstore and how it is used


  • perform model validation
  • use conditional validation
  • use custom validators in models
  • use custom validators in classes
  • compare using the errors[ ] with the invalid? method
  • recall what methods do not invoke validations
  • protect against attacks by controlling mass-assignment attributes

Advanced ActiveRecord

  • use .where and .find
  • execute a raw SQL query
  • compare the .select and .pluck methods
  • use different finder methods to retrieve objects from the database


  • define and chain query criteria
  • chain scopes with lambdas

Eager Loading

  • load all the specified associations with the minimum number of queries

Virtual Models

  • use active model

ActiveRecord Concerns

  • recall how to use modules to share functionality between disparate model classes

Model Callbacks

  • use conditional callbacks
  • use transaction callbacks

Practice: ActiveRecord

  • use ActiveRecord to model data

Framework Connections

The materials within this course focus on the Knowledge Skills and Abilities (KSAs) identified within the Specialty Areas listed below. Click to view Specialty Area details within the interactive National Cybersecurity Workforce Framework.