HOME JAVA & JEE AJAX & RIA AGILE & SCRUM SOA & REST ERLANG RUBY ON RAILS OPEN SOURCE .NET DESIGN & DDD CLOUD & GRID  
Introduction to Routing and REST in Rails (ROUTING-REST-01-01)
CODE: ROUTING-REST-01-01          DURATION: 1 DAY/S
This one-day course is an intensive, in-depth introduction to the routing system in Rails. Participants will learn how the routing system works, and how to write routing rules that streamline and clarify application design. The routing system is the foundational layer for Rails's support of REST-compliant program, and the course will also look closely at REST and how Rails has incorporated RESTful principles into aspects of routing. Participants will see, and try, examples of resource-based routing, and will go beyond the boilerplate cases to understand how RESTful routing techniques can be customized and fine-tuned to the advantage of programmers and code maintainers.

LEARN HOW TO:
  • Visualize how the Rails routing system is designed
  • Comprehend principle routing techniques
  • Understand the basic tenets of REST
  • Implement REST-compliant techniques offered by Rails
  • Become familiar with best practices, "tips and tricks", as well as the pitfalls of RESTful Rails programming
PROGRAMME
The two faces of routing
  • Recognition: Determine what to do, given a URL
  • Generation: Create a URL or path string
The routes.rb rules file
  • A big code block
  • "map": a Mapper object (a magic pen)
  • Fall-through rule matching
  • Rules (routes) and macros (batch routes and resources)
  • Setting a top-level route
URL recognition
  • Positional matching with pattern string
  • Controller/action determination
  • Regular expression constraints on matches
  • Route globbing
  • Route scoping
  • The empty and default routes
Customizing routes for recognition
  • Static substrings in the pattern string
  • Symbol parameters
  • Regular expression constraints
  • Taking advantage of fall-through rules
URL/path generation
  • In the views: link_to, form_for, and friends
  • In the controllers: redirect_to
  • The matching algorithm
  • Defaulting to current request values
  • URLs vs. paths
Named routes
  • From missing method to method name
  • Named routes with arguments
  • Cleaning up views with named routes
  • Sensible route naming
Testing and examining routes
  • assert_generates
  • assert_recognizes
  • assert_routing
  • Interpreting route information
  • Examining routes in the console
  • The rake routes task
REST: an introduction
  • The key components of a RESTful system
  • REST on the Web: returning to roots of HTTP
  • Resources
  • Representations
  • REST compared with SOAP
REST in Rails: the principles
  • Routing switching on HTTP request method
  • Hard-coded action names
  • Convention, convention, convention
REST in Rails: the practice
  • Batch route creation with map resources
  • The resource routing calculus
  • Adding custom resource routes with :member and :collection
  • Nested resources: how, why, why not
  • Resource routing in forms
  • Resource-based scaffolding: a honeypot
  • Singleton resources (map resource)
ABOUT THE AUTHOR
David A. Black is a well-known and highly regarded Ruby and Rails programmer, author, conference speaker and trainer.
More about David Black
IS THIS COURSE FOR YOU?
Rails developers who want to understand how the routing subsystem works. Participants might have used RESTful routing techniques, but want to grasp the concepts behind the engineering -- the what, and the why -- and to go beyond the boilerplate techniques (scaffolding, generic "map resources", etc.).

COURSE PREREQUISITES
To benefit from this course, you should have some first-hand experience with Rails development.

COURSE LABS & EXERCISES
This course employs a mixture of hands-on lab time and informational lecture to enable you to best absorb the material.

© Copyright 2003-2008, Skills Matter Ltd
  Web development by You In Control
About Us  Jobs  Find Us  Meeting & Training Rooms  Newsletter  Community  Community-FR  Heros  Promotions  Apress