开发者

I18n.t instead of hard value results in a different url

I have a link like this:

<%= link_to "Logout", destroy_user_session开发者_运维技巧_path, :method => :delete %>

This results in a link with the url "/users/sign_out". When I replace this with i18n like this:

<%= link_to I18n.t :logout_link, destroy_user_session_path, :method => :delete %>

It results in a link with the right text, but the url is "site/index", which is my root_path. Why is this going wrong? Thanks!


please try this:

<%= link_to I18n.t(:logout_link), destroy_user_session_path, :method => :delete %>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜