views:

20

answers:

1

I am upgrading my application to rails 3. My old route was

map.profile 'profile/:login', :controller => 'profile', :action => 'show'

I changed this to:

 match 'profile/:login', :to => 'profile#show'

This works when I enter in the route say /profile/red99

But when I use a generic link like:

 <%= link_to image.user.login, :controller => "profile", :action => image.user.login %>  

or

 <%= link_to "public profile", :controller => "profile", :action => current_user.login %>

I gives me the error No route matches {:controller=>"profile", :action=>"red99"}

+1  A: 

If you want to specify the URL for the profile you still need to use the parameters:

:controller => 'profile', :action => 'show', :login => current_user.login

You haven't changed the action parameter by defining that route, you've simply made a more readable URL by implicitly specifying the action.

Shadwell