Module: ActionView::Helpers::FormTagHelper

Defined in:
lib/zero-captcha/form_tag_helper.rb

Instance Method Summary collapse

Instance Method Details

#form_tag_html_with_zero_captcha(options) ⇒ Object Also known as: form_tag_html



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/zero-captcha/form_tag_helper.rb', line 5

def form_tag_html_with_zero_captcha(options)
  zero_captcha = options.delete(:zero_captcha) || options.delete('zero_captcha')
  html = form_tag_html_without_zero_captcha(options)
  if zero_captcha
    captcha = "".respond_to?(:html_safe) ? zero_captcha_html.html_safe : zero_captcha
    if block_given?
      html.insert(html.index('</form>'), captcha)
    else
      html += captcha
    end
  end
  html
end