Introduction to Models


Overview/Description
Target Audience
Prerequisites
Expected Duration
Lesson Objectives
Course Number
Expertise Level



Overview/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.

Target Audience
Programmers looking to expand their skill set in the Rails environment

Prerequisites
None

Expected Duration (hours)
2.0

Lesson Objectives

Introduction to Models

  • 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
  • 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
  • load all the specified associations with the minimum number of queries
  • use active model
  • recall how to use modules to share functionality between disparate model classes
  • use conditional callbacks
  • use transaction callbacks
  • use ActiveRecord to model data
  • Course Number:
    sd_rorf_a02_it_enus

    Expertise Level
    Intermediate