The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
What's New in Edge Rails: Use Rake to List Your Routes

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
rwdaigle

Posts: 312
Nickname: rwdaigle
Registered: Feb, 2003

Ryan is a passionate ruby developer with a strong Java background.
What's New in Edge Rails: Use Rake to List Your Routes Posted: Jul 2, 2007 3:35 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by rwdaigle.
Original Post: What's New in Edge Rails: Use Rake to List Your Routes
Feed Title: Ryan's Scraps
Feed URL: http://feeds.feedburner.com/RyansScraps
Feed Description: Ryan Daigle's various technically inclined rants along w/ the "What's new in Edge Rails" series.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by rwdaigle
Latest Posts From Ryan's Scraps

Advertisement

While you’ve always been able to manually take a peek at what routes are defined in your application, this dollop of usefulness has now found its way into a rake task.

Just run


rake routes

and voila, all routes defined will be spit out in a tidy columnar form with the following columns:

route name, HTTP method, route path, route requirements

As an example, here is what my output looks like:

1
2
   all_articles GET  /articles;all/      {:action=>"all", :controller=>"articles"}
search_articles GET  /articles;search/   {:action=>"search", :controller=>"articles"}
For those of us not riding edge, it’s pretty easy to get access to this task in your app:

curl http://svn.rubyonrails.org/rails/trunk/railties/lib/tasks/routes.rake > lib/tasks/routes.rake

This is particularly useful in RESTful implementations as there’s lot of routing magic happening for you under the covers. Now you have the means to take a harmless peek under said covers.

tags: ruby, rubyonrails, rake

Read: What's New in Edge Rails: Use Rake to List Your Routes

Topic: My iPhone Previous Topic   Next Topic Topic: Cold Turkey @ Trax

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use