routes Tag

This is my first screencast. I’ve learned a lot about recording screencasts while doing this. The screencast was recorded using a free trial of Camtasia for Mac. The trial is up in 30 days, so I’d really appreciate donations to help me get ScreenFlow so I can continue to produce screencasts.

In the meantime, here’s a basic rundown of the 4 basic types of routes in Ruby on Rails.

Ruby on Rails gives you some simple but powerful tools for mapping URL’s and HTTP Verbs to your Controllers and Views. Here is a simple walkthrough of 4 of these ‘Routes’: default routes, regular routes, named routes, and RESTful routes.

  • DZone
  • Twitter
  • Slashdot
  • Delicious
  • Digg
  • Technorati Favorites
  • Facebook
  • Reddit
  • StumbleUpon
  • LiveJournal
  • Squidoo
  • Google Bookmarks
  • LinkedIn
  • Share/Bookmark

I had a friend email me a week or so ago about generating a link from your restful routes when you don’t know the class. Here’s a quick thumbnail of the scenario.

You have a bunch of restful routes like these:

1
2
map.resources :users
map.resources :groups

And you have a model that has a polymorphic association, meaning that it has an associated value that can be from more than one model. Here’s an example of how that’s done.
Read More

  • DZone
  • Twitter
  • Slashdot
  • Delicious
  • Digg
  • Technorati Favorites
  • Facebook
  • Reddit
  • StumbleUpon
  • LiveJournal
  • Squidoo
  • Google Bookmarks
  • LinkedIn
  • Share/Bookmark