使用 rails link_to 辅助锚标记时,在 URL 中添加了不必要的字符
unnecessary characters getting added in URL when using rails link_to helper anchor tag
我正在尝试将 #xyz
添加到使用 rails link_to
助手生成的 link。
以下是我的代码:
<%= link_to('', edit_notification_path(:id => item.id,:type =>"requester_template",
:notification_type => @notification_type,:anchor => "#xyz"),
:class => 'icon-pencil-3' ) %>
但是生成的 URL 看起来像
email_notifications/3/edit/requester_template?notification_type=ticket#%23es
那就是有一个额外的 %23 是用锚点添加的。
我在这里做错了什么? (Rails 初学者)
您必须将 :anchor => "#xyz"
更改为 :anchor => "xyz"
。选项 :anchor
已经包含 #
.
试试这个
<%= link_to('', edit_notification_path(id: item.id,type: "requester_template",
notification_type: @notification_type,anchor: "xyz"),
class: 'icon-pencil-3' ) %>
我正在尝试将 #xyz
添加到使用 rails link_to
助手生成的 link。
以下是我的代码:
<%= link_to('', edit_notification_path(:id => item.id,:type =>"requester_template",
:notification_type => @notification_type,:anchor => "#xyz"),
:class => 'icon-pencil-3' ) %>
但是生成的 URL 看起来像
email_notifications/3/edit/requester_template?notification_type=ticket#%23es
那就是有一个额外的 %23 是用锚点添加的。
我在这里做错了什么? (Rails 初学者)
您必须将 :anchor => "#xyz"
更改为 :anchor => "xyz"
。选项 :anchor
已经包含 #
.
试试这个
<%= link_to('', edit_notification_path(id: item.id,type: "requester_template",
notification_type: @notification_type,anchor: "xyz"),
class: 'icon-pencil-3' ) %>