Introduction to Models

Programmers looking to expand their skill set in the Rails environment

Prerequisite
None

Expected Duration
122 minutes

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.

Objective

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

Validation

  • 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

Scopes

  • 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

MONTHLY SUBSCRIPTION

$129/month
 

ANNUAL SUBSCRIPTION

$1295/year

Multi-license discounts available for Annual and Monthly subscriptions.