Using translation variable in link_to

HI ,

In ROR , i m having a line like

 <%= link_to("NAME (#{@name})", user_path(@user, :in => :s)) %>

i want to change the string NAME to t(:str_name) …

how to change it . when i change it , i am getting errors…

On Sep 15, 2010, at 23:39 , Aruna C. wrote:

how to change it . when i change it , i am getting errors…
you should ask on the rubyonrails forum instead.

On Sep 16, 2010, at 2:39 AM, Aruna C. wrote:

In ROR , i m having a line like

<%= link_to("NAME (#{@name})", user_path(@user, :in => :s)) %>

i want to change the string NAME to t(:str_name) …

how to change it . when i change it , i am getting errors…

Without the actual error message I’m guessing but you probably want
something like:

<%= link_to("#{t(:str_name)} (#{@name})", user_path(@user, :in => :s))
%>

And if that fixes your problem then, ruby-talk was an appropriate place
for the
question since it is just a language issue and not a Rails issue.

Gary W.

Gary W. wrote:

On Sep 16, 2010, at 2:39 AM, Aruna C. wrote:

In ROR , i m having a line like

<%= link_to("NAME (#{@name})", user_path(@user, :in => :s)) %>

i want to change the string NAME to t(:str_name) …

how to change it . when i change it , i am getting errors…

Without the actual error message I’m guessing but you probably want
something like:

<%= link_to("#{t(:str_name)} (#{@name})", user_path(@user, :in => :s))
%>

And if that fixes your problem then, ruby-talk was an appropriate place
for the
question since it is just a language issue and not a Rails issue.

Gary W.

Thanks Gary .
Its worked for me…