移除<a> tag from rails &#34;link_to&#34; methdo

时间:2016-08-27 14:49:45

标签: html ruby-on-rails ruby-on-rails-4 internationalization

I need to remove <a> tag from rails link_to method. Here is current code and result:

<%= link_to "ESP", :locale=>'es'%>
<a href="/es/blog/crazy_page">ESP</p>

Here is my desired outcome:

/es/blog/crazy_page

Reason I need this is so I could make "alternate" link tag in header for each language. Can't seem to find this anywhere.

1 个答案:

答案 0 :(得分:1)

使用url_for方法

<%= url_for(:locale => 'es') %>