DanielsV DanielsV - 3 months ago 17
HTML Question

Remove <a> tag from rails "link_to" methdo

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.

Answer

Use url_for method

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