Your SlideShare is downloading. ×
  • Like
  • Save
Nested REST resources with Rails 1.2
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Now you can save presentations on your phone or tablet

Available for both IPhone and Android

Text the download link to your phone

Standard text messaging rates apply

Nested REST resources with Rails 1.2

  • 3,998 views
Published

A presentation on RESTful routing and resources in Rails 1.2. I stepped through some code to show how to get started with the scaffold_resource generator, set up nested resources using REST, use the …

A presentation on RESTful routing and resources in Rails 1.2. I stepped through some code to show how to get started with the scaffold_resource generator, set up nested resources using REST, use the new named routes, and use respond_to to return information in different formats (HTML/XML/JS/JSON). I also talked about the motivations behind RESTful design, and concrete advantages to embracing REST.

Published in Business , Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
3,998
On SlideShare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
0
Comments
0
Likes
1

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. RESTful Routing Basics RoR Meetup, 1/18/2007 Andre Lewis
  • 2. What You’ll Learn
    • Getting started with RESTful resources in Rails 1.2
    • Using scaffold_resource
    • How to nest resources
  • 3. Motivation
    • Why care about REST?
    • What can REST do for you?
  • 4.
    • 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
  • 5. The REST Mindset
    • Think in terms of:
      • C reate  GET /items/new
      • R etrieve  GET /items/1
      • U pdate  PUT /items/1
      • D elete  PUT /items/1;delete
    • Let the constraints imposed by CRUD guide your controller design
  • 6. Let’s code a Nested Resource
  • 7. 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
  • 8. 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?
  • 9. My Info Book http:// earthcode.com Blog [email_address] Email