在使用帮助程序(表单、javascript、css 等)时,如何配置 Ruby on Rails 以输出标准 HTML 代码而不是 XHTML?
我不想在末尾有斜杠:
<input name="email" type="text" />
最佳答案
这个答案包含在 MarkusQ 提供的链接中,但我想我可以准确拼写出来。
你必须修改代码而不是呈现所有标签,你可以通过将以下代码包含到类似 lib/dont_use_xhtml.rb 的文件中来做到这一点
module ActionView::Helpers::TagHelper
alias :tag_without_backslash :tag
def tag(name, options = nil, open = true, escape = true)
tag_without_backslash(name, options, open, escape)
end
end
关于html - 配置 Rails 以输出 HTML 输出而不是 XHTML,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/595867/