Duration
2 days
Objective
This course describes how to write database-backed Web Applications using the Ruby on Rails Framework. Students are taken through the various steps of creating a full-fledged Web Application. Topics include the MVC paradigm, object relational mapping, fill in forms, sessions, validation techniques, testing, and various other Rails topics.
Prerequisite
Students should have been through a course in the Ruby Programming language. They should also have an understanding of HTML. Students should also have experience with a SQL compliant database such as MySQL.
Chapter 1: An Overview Of Ruby on Rails
What is Ruby on Rails?
Overview of Rails Components
Installing Rails
A Simple Rails Application
Starting the Rails Server
Static Pages Within a Rails Application
The Structure of a Rails Application
Generating a Controller
Rendering the View
Adding a Static Page
Dynamic Pages with Embedded Ruby
Using the render Method
Using the link_to Method
Chapter 2: Rails and HTML Forms
A Basic HTML Form
Processing an HTML Form
Working With Form Data
Other Form Elements
Form Tag Helpers
Chapter 3: Databases and Rails
Review of the MVC Architecture
Entities and Relationships
Databases and Models
Rails Database Conventions
Adding a Model
Database Migrations
The Rails Database Console
Creating a Rails View of a Database Table
Scaffolding
RESTful Routes and Resources
Introduction
Form Helpers and form_for
Processing Form Helpers
From Form to Database
Redirection
Data Validation
Validation Helpers
The presence Validator
The numericality Validator
The uniqueness Validator
The length Validator
The format Validator
Custom Validation Methods
The errors Object
Displaying Validation Errors in the View
Chapter 5: Adding Style to an Application
Styling
Rails and Sass
Cascading Style Sheets
Introduction
Configuring an Application for Sessions
Registering Users
The Register Action
The flash Hash
Validating the Registration
Logging in
Logging Out
Protected Pages
Filters
Introduction
The Business Application
Database Terminology
Linking Two Models
Adding Tasks
The Database Tables
Displaying Employee Tasks
Deleting a Task
Listing Employees and Tasks
Migrations
Editing a Record
Summary
Programme scope, delivery arrangements and suitability are confirmed during enquiry.