rails路由中的URL问题

时间:2013-09-09 21:41:21

标签: ruby-on-rails routing

我的链接如下

<%= link_to member.full_name,{:controller => "reports",:action => "student_details", :stud_id => member.id,:vehicle_id=>@vehicle,:type=>@type,:month=>@start_date,:category=>@category } %>

在routes.rb中我定义为

 map.connect    "/reports/student_details", :controller => reports',:action => 'student_details'

但是,当我点击此链接并转到该页面时,该网址显示为完整网址,链接中附加了所有参数。我希望将网址缩短为reports/student_details/id 我该怎么做..请帮忙..

1 个答案:

答案 0 :(得分:0)

您需要修改路线以包含学生ID

map.connect "/reports/student_details/:stud_id", :controller => reports',:action => 'student_details'