Is there a method to return a hash of the route configuration based on
a path?
For example:
magic_method(’/my_controller/my_action/my_id’)
=>
{:controller => ‘my_controller’, :action => ‘my_action’, :id =>
‘my_id’}
Thanks!
Tom
Is there a method to return a hash of the route configuration based on
a path?
For example:
magic_method(’/my_controller/my_action/my_id’)
=>
{:controller => ‘my_controller’, :action => ‘my_action’, :id =>
‘my_id’}
Thanks!
Tom
On Nov 16, 2007, at 12:21 PM, TomRossi7 wrote:
Is there a method to return a hash of the route configuration based on
a path?For example:
magic_method(’/my_controller/my_action/my_id’)
=>
{:controller => ‘my_controller’, :action => ‘my_action’, :id =>
‘my_id’}
recognize_path(’/my_controller/my_action/my_id’)
– gw (www.railsdev.ws)
Excellent! That is exactly what I am looking for except I can’t seem to
figure out how to call the method.
From an IRB console:
ActionController::Routing::RouteSet.recognize_path
(’/my_controller/my_action/my_id’)
NoMethodError: undefined method `recognize_path’ for
ActionController::Routing::RouteSet:Class
I am running Rails 1.2.5 if that matters.
Thanks!
Tom
Hi –
On Fri, 16 Nov 2007, Tom R. wrote:
Excellent! That is exactly what I am looking for except I can’t seem to
figure out how to call the method.From an IRB console:
ActionController::Routing::RouteSet.recognize_path
(‘/my_controller/my_action/my_id’)
NoMethodError: undefined method `recognize_path’ for
ActionController::Routing::RouteSet:Class
ActionController::Routing::Routes.recognize_path
David
–
Upcoming training by David A. Black/Ruby Power and Light, LLC:
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs