Ruby on Rails
Revision: TE3602_20071212
Course Length:
2 Days
Course Description:
This course describes how to write database-backed Web Applications using the Ruby on Rails (also pronounced RoR, or 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.
Who Should Attend:
Who Should Attend: A typical student in this course has either been tasked with writing a Rails application, or has been tasked with evaluating the Rails framework. Thus, this course should be attended by developers and managers alike, and possibly system administrators.
Benefits of Attendance:
Upon completion of this course, students will be able to:
- Download and install Rails along with various other products that allow one to write Rails applications
- Understand the Model, View, Controller paradigm and how this applies to Rails applications
- Understand the directory structure of a Rails application
- Build non-trivial database backed Web Applications
- Understand the ActiveRecord classes and how they wrap database tables
- Understand the interplay between various controller actions and .rhtml (template) files
- Understand the Create, Read, Update, and Destroy (CRUD) paradigm
- Validate Model data
- Test Rails applications
- Use the Rails console to debug applications
Prerequisites:
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.
Course Outline:
- Chapter 1: An Overview Of Ruby on Rails
- What is Ruby on Rails?
- Downloading Rails
- A Rails Application
- Building the Controller
- Views
- Embedded Ruby
- Extended Time Functions
- The render Method
- The link_to Method
- Chapter 2: Fill in Forms
- Form Data
- Building a Form
- Explaining the Form
- The Controller
- The View
- Contacting the Application
- Checkboxes
- Radio Buttons
- Rails Helper Methods
- Loading the Form
- Submitting the Form
- result.rhtml
- Chapter 3: Databases and Rails
- Review of MVC
- Entities and Relationships
- Databases
- Setting the Database for Rails
- Controller and Model
- Running the Application
- The list Template - Beginning
- Adding a New Item
- Partial Rendering
- Saving the New Object
- The list Template - Continued
- The flash Hash
- Layouts
- Stylesheets
- Editing a Record
- Displaying a Record
- Deleting a Record
- Chapter 4: Sessions
- Purchasing Items
- Retrieving Records
- Clarification of Types
- The View
- The New Models
- The purchases Table
- Creating a Purchase Object
- Adding a Purchase to the Cart
- Sessions
- Placing the Cart in the Session
- Displaying the Cart
- A Shopping Cart
- Clearing the Session
- Conveniences
- Chapter 5: Validation Techniques
- Data Validation
- A Validation Application
- Validating the Presence of an Entry
- Validating a Numerical Field
- Validating for Uniqueness
- Validating Lengths
- Validating Formats
- Writing Your Own Validation Methods
- Validation Summary
- Chapter 6: Checking Out
- Introduction
- Additional Database Tables
- Making Table Relationships Known to Rails
- Beginnings
- Capturing the Order Form Data
- Saving an Order
- Observing the Table Relationships
- Chapter 7: Users
- Introduction
- A Simple Beginning
- A Little Review
- A Little Style
- The User Model
- Registration
- Login
- Logging in
- Logging Out
- Filters
- Chapter 8: Migrations
- Introduction
- The First Migration
- The Rails Console
- Writing a Simple Application
- The Next Migration
- Magic Fields
- The Next Migration - Revisited
- Data Types
- Chapter 9: Testing the Application
- Introduction
- Test::Unit
- Testing Your Own Classes
- Fixtures
- Testing Models
- Testing Controllers
- test_helper.rb
- Integration Testing
- Chapter 10: Odds and Ends
- Routing
- routes.rb
- Testing Maps
- Routing Shortcuts
- Fancy URLs
- RubyGems
- The Flash
- Before and After Filters
- rdoc
- Debugging



