带有HTML实体转义的Ruby on Rails Slim模板

带有HTML实体转义的Ruby on Rails Slim模板,html,ruby-on-rails,html-entities,slim-lang,Html,Ruby On Rails,Html Entities,Slim Lang,我有一个RoR slim模板,包含以下内容: input(type="text" placeholder="I'm looking for&hellip;") 但遗憾的是,它输出HTML实体转义“原样”,即字符串文本。我正在使用rails gem“slim”模板渲染输入字段 所需的带有省略号字符的输出 <input type="text" placeholder="I'm looking for…"> 非常感谢。 <%= text_field_tag nil, ni

我有一个RoR slim模板,包含以下内容:

input(type="text" placeholder="I'm looking for&hellip;")
但遗憾的是,它输出HTML实体转义“原样”,即字符串文本。我正在使用rails gem“slim”模板渲染输入字段

所需的带有省略号字符的输出

<input type="text" placeholder="I'm looking for…">
非常感谢。


<%= text_field_tag nil, nil, placeholder: "I'm looking for&hellip;".html_safe %>

或者提供有关输入助手的更多信息

自我解决、简单的解决方案、明显的答案-需要一组括号:

input(type="text" placeholder=("I'm looking for&hellip;".html_safe))

请您发布原始输出和所需输出。请注意:“首选”方法是使用
raw
或甚至可能是
sanitize
方法。与当前的
html\u-safe
相比,
raw
的唯一优势在于,它在将对象标记为
html\u-safe
之前调用对象上的
,因此它可以处理任何可以转换为字符串的对象,而不仅仅是字符串。我想它将来做更复杂的事情的可能性很小。只是另一个注释:“实际上不需要括号集”。以前您在
input
上调用
html\u-safe
,这是不正确的,现在您在字符串上调用它,然后将其作为占位符属性的值输入。这不是SLIM,这是ERB。
<%= text_field_tag nil, nil, placeholder: "I'm looking for&hellip;".html_safe %>
input(type="text" placeholder=("I'm looking for&hellip;".html_safe))