2016-10-26 1 views
0

link_toヘルパーを使用して生成されたリンクに#xyzを追加しようとしています。レールを使用すると不要な文字がURLに追加されるlink_toヘルパーアンカータグ

<%= link_to('', edit_notification_path(:id => item.id,:type =>"requester_template", 
:notification_type => @notification_type,:anchor => "#xyz"), 
:class => 'icon-pencil-3') %> 

しかし、生成されたURLはアンカーに追加される余分な23%が存在している

email_notifications/3/edit/requester_template?notification_type=ticket#%23es 

次のようになります。後

は私のコードです。

私はここで間違っていますか? (Railsの初心者はこちら)

答えて

1

:anchor => "#xyz":anchor => "xyz"に変更する必要があります。オプション:anchorにはすでに#が含まれています。

0

この

<%= link_to('', edit_notification_path(id: item.id,type: "requester_template", 
notification_type: @notification_type,anchor: "xyz"), 
class: 'icon-pencil-3') %> 
をお試しください
関連する問題