2010-09-02 134 views
0

我升级我的应用程序轨道3.我的旧路线被轨道3命名路由

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

我把它改为:

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

当我在航线进入这工作说/ profile文件/ red99

但是当我使用像普通链接:

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

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

我给我的错误没有路由匹配{:控制器=> “个人资料”,:动作=> “red99”}

回答

2

如果要指定配置文件的URL你还需要使用参数:

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

你还没有通过定义路线改变了action参数,你只是发通过隐含指定动作更可读的URL。