I'm trying to add #xyz
to a link which is generated using rails link_to
helper.
Following is my code:
<%= link_to('', edit_notification_path(:id => item.id,:type =>"requester_template",
:notification_type => @notification_type,:anchor => "#xyz"),
:class => 'icon-pencil-3' ) %>
But the generated URL looks like
email_notifications/3/edit/requester_template?notification_type=ticket#%23es
That is there is an extra %23 that gets added with the anchor.
What am I doing wrong here ? ( Rails beginner here )
You have to change :anchor => "#xyz"
to :anchor => "xyz"
. The option :anchor
already includes the #
.
Try this
<%= link_to('', edit_notification_path(id: item.id,type: "requester_template",
notification_type: @notification_type,anchor: "xyz"),
class: 'icon-pencil-3' ) %>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.