[英]how to add a string to the path in link_to of ruby on rails
例如,我有以下代碼:
<%= link_to "Start", start_path(:id=>1,:box=>1)%>
id
和box
是參數嗎? 例如,它生成了以下網址: http:// localhost:3000 / start?id = 1&box = 1
我如何添加一個字符串,使其看起來像這樣:
使用:anchor
鍵:
<%= link_to "Start", start_path(:id => 1, :box => 1, :anchor => 'box_1')
要回答您的第一個問題,是的, id
和box
是參數。 它們作為params
哈希的一部分傳遞到請求中。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.