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 %>
精彩评论