我已经尝试了一段时间......
<%= ("<h3>(#{@user.first_name.capitalize}" + I18n.t('helpers.s_page') +
I18n.t('find_something.empty_user_other')</h3>").html_safe %>
你能说出正确的方法是什么......感谢您的帮助。
克里斯。
答案 0 :(得分:1)
这应该有效:
<h3>
<%= @user.first_name.capitalize %>
<%= I18n.t 'helpers.s_page' %>
<%= I18n.t 'find_something.empty_user_other' %>
</h3>
这样,您根本不需要使用html_safe
,假设<% %>
部分中的字符串不包含HTML。