Frage

I've been trying this for a while now...

<%= ("<h3>(#{@user.first_name.capitalize}" + I18n.t('helpers.s_page') + 
      I18n.t('find_something.empty_user_other')</h3>").html_safe %>

Can you tell me what the right way of putting it is... thanks for any help.

Chris.

War es hilfreich?

Lösung

This should work:

<h3>
  <%= @user.first_name.capitalize %>
  <%= I18n.t 'helpers.s_page' %>
  <%= I18n.t 'find_something.empty_user_other' %>
</h3>

And that way you don't need to use html_safe at all, assuming those strings in the <% %> sections don't contain HTML.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top