Restful routing basics l.jpg
This presentation is the property of its rightful owner.
Sponsored Links
1 / 9

RESTful Routing Basics PowerPoint PPT Presentation


  • 97 Views
  • Uploaded on
  • Presentation posted in: General

RESTful Routing Basics. RoR Meetup, 1/18/2007 Andre Lewis. What You’ll Learn. Getting started with RESTful resources in Rails 1.2 Using scaffold_resource How to nest resources. Motivation. Why care about REST? What can REST do for you?. …. Fewer decisions to make

Download Presentation

RESTful Routing Basics

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Restful routing basics l.jpg

RESTful Routing Basics

RoR Meetup, 1/18/2007

Andre Lewis


What you ll learn l.jpg

What You’ll Learn

  • Getting started with RESTful resources in Rails 1.2

  • Using scaffold_resource

  • How to nest resources


Motivation l.jpg

Motivation

  • Why care about REST?

  • What can REST do for you?


Slide4 l.jpg

  • Fewer decisions to make

  • More easily understand other’s work, or your own older work

  • Nice URLs

  • Convenient named routes

  • XML/JS/JSON responses, easier


The rest mindset l.jpg

The REST Mindset

  • Think in terms of:

    • Create GET /items/new

    • Retrieve GET /items/1

    • Update PUT /items/1

    • Delete PUT /items/1;delete

  • Let the constraints imposed by CRUD guide your controller design


Let s code a nested resource l.jpg

Let’s code a Nested Resource


Review nested resources l.jpg

Review: Nested Resources

  • Create the resource scaffolding and migrations

  • Set up relationships in models

  • Modify routes.rb

  • Modify the controller of the nested resource

    • add a before_filter

    • amend the *_url calls in create and update actions

    • scope your Comment (nested class) finders to the Post (nestee class)

  • Modify the views

  • Provide a link to the nested resource


Rest learn more l.jpg

REST: Learn More

  • My blog post at http://earthcode.com

  • DHH's REST keynote (get the slides too!)

    • http://www.loudthinking.com/lt-files/worldofresources.pdf

    • http://www.scribemedia.org/2006/07/09/dhh/

  • The 2nd edition of Pragmatic's Agile Web Development

  • Peepcode screencast and cheatsheet

Questions/Feedback?

  • what about *optionally* nested resources?

  • What about the new/edit request.get? pattern?

  • Is it “bad” to put additional methods on your RESTful controllers?


My info l.jpg

My Info


  • Login