Html – is there a way to ask Rails helper functions not to produce XHTML but HTML

htmlruby-on-railsxhtml

I would like to use HTML 4.01 Strict, and used a DOCTYPE of it in my application template. But look like when a style sheet is included by a helper function

<%= stylesheet_link_tag 'style' %>

the code produced is XHTML:

<link href="/stylesheets/style.css?1243210734" media="screen" rel="stylesheet" type="text/css" />

is there a way to ask Rails to produce HTML instead of XHTML? (so that the HTML will validate for example)

Best Answer

Just a quick fix to the included code above, which does work.

module ActionView::Helpers::TagHelper
  def tag_with_html(name, options = nil, open = true, escape = true)
    tag_without_html(name, options, true, escape)
  end
  alias_method_chain :tag, :html
end

Thanks for the tip!

Related Topic