简体   繁体   English

Rails路由中的URL问题

[英]URL issue in rails routing

I have a link as below 我有如下链接

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

In the routes.rb I have defined as 在routes.rb中,我定义为

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

But when I click this link and go to the page, the url is showing as complete url with all the params appended in the link.. I want the url to be shortened like, reports/student_details/id How do I do that.. Please help.. 但是,当我单击此链接并转到页面时,该URL显示为完整的URL,并在该链接中附加了所有参数。.我希望缩短该URL,例如, reports/student_details/id我该怎么做。请帮忙..

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM