Configure Rails to output HTML output instead of XHTML

后端 未结 4 2020
说谎
说谎 2021-02-04 16:34

How do I configure Ruby on Rails to output standard HTML code instead of XHTML when using helpers (form, javascript, css, etc.)?

I don\'t want to have t

4条回答
  •  猫巷女王i
    2021-02-04 17:22

    The solution does not work with the latest version of Rails. Some helpers will override the open method argument of 'open' to 'false'.

    The following works for me in Rails 2.3.5:

    module ActionView::Helpers::TagHelper
      def tag_with_html_patch(name, options = nil, open = true, escape = true)
        tag_without_html_patch(name, options, true, escape)
      end
      alias_method_chain :tag, :html_patch
    end
    

    Put that into an initializer.

提交回复
热议问题