module Cell::Erb

Erb contains helpers that are messed up in Rails and do escaping.

Constants

VERSION

Public Instance Methods

capture(*args) { |*args| ... } click to toggle source
# File lib/cell/erb/template.rb, line 13
def capture(*args)
  yield(*args)
end
concat(string) click to toggle source
# File lib/cell/erb/template.rb, line 39
    def concat(string)
      raise "[Cells-ERB] The #concat helper uses global state and is not supported anymore.
Please change your code to simple `+` String concatenation or tell the gem authors to remove #concat usage."
    end
content_tag(name, content_or_options_with_block=nil, options=nil, escape=false, &block) click to toggle source

Below: Rails specific helper fixes. I hate that. I can't tell you how much I hate those helpers, and their blind escaping for every possible string within the application.

Calls superclass method
# File lib/cell/erb/template.rb, line 20
def content_tag(name, content_or_options_with_block=nil, options=nil, escape=false, &block)
  super
end
form_tag_html(html_options) click to toggle source
# File lib/cell/erb/template.rb, line 34
def form_tag_html(html_options)
  extra_tags = extra_tags_for_form(html_options)
  "#{tag(:form, html_options, true) + extra_tags}"
end
form_tag_with_body(html_options, content) click to toggle source
# File lib/cell/erb/template.rb, line 30
def form_tag_with_body(html_options, content)
  "#{form_tag_html(html_options)}" << content.to_s << "</form>"
end
tag_options(options, escape = true) click to toggle source

We do statically set escape=true since attributes are double-quoted strings, so we have to escape (default in Rails).

Calls superclass method
# File lib/cell/erb/template.rb, line 26
def tag_options(options, escape = true)
  super(options, true)
end
template_options_for(options) click to toggle source
# File lib/cell/erb/template.rb, line 6
def template_options_for(options)
  {
    template_class: ::Cell::Erb::Template,
    suffix:         "erb"
  }
end