Sha256: ad9920f660ea80663f0762aa90c10174852925b28c65560e261e45702ef6338b

Contents?: true

Size: 600 Bytes

Versions: 1

Compression:

Stored size: 600 Bytes

Contents

module ActsAsTextcaptcha
  module TextcaptchaHelper

    def textcaptcha_fields(f, &block)
      if f.object.perform_textcaptcha? && f.object.textcaptcha_key
        build_textcaptcha_form_elements(f, &block)
      end
    end

    private

      def build_textcaptcha_form_elements(f, &block)
        captcha_html = f.hidden_field(:textcaptcha_key)
        if f.object.textcaptcha_question
          captcha_html += capture(&block)
        elsif f.object.textcaptcha_answer
          captcha_html += f.hidden_field(:textcaptcha_answer)
        end
        captcha_html.html_safe
      end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
acts_as_textcaptcha-4.4.1 lib/acts_as_textcaptcha/textcaptcha_helper.rb