Is there a tool or code fragment tat can be used with irb via
scripts/console to test toutes/
Sort of
Prompt for input
responds with the route
Thanks
–
“Hello, my name is Inigo Montoya, you killed my father, prepare to die.”
The Princess Bride,
William Goldman
On 12/14/07, Anton J Aylward [email protected] wrote:
Is there a tool or code fragment tat can be used with irb via
scripts/console to test toutes/
Sort of
Prompt for input
responds with the route
Thanks
One way is to start an inner irb session on
ActionController::Routing::Routes
$ script/console
Loading development environment (Rails 2.0.1)
irb ActionController::Routing::Routes
recognize_path(“/”)
=> {:controller=>“people”, :action=>“index”}
recognize_path(“/login”)
=> {:controller=>“session”, :action=>“new”}
generate(:controller=>“people”, :action => “index”)
=> “/people”
This should work with Rails 1.2.x as well as Rails 2.0.x
Rails 2.0.x also has a rake task to list the routes:
$rake routes
–
Rick DeNatale
My blog on Ruby
http://talklikeaduck.denhaven2.com/