Sha256: 4e685e2234a0f0a3b4e5c93d8413a88e49a20f1c75be96d2145ed8a338e6441f

Contents?: true

Size: 728 Bytes

Versions: 1

Compression:

Stored size: 728 Bytes

Contents

module ActsAsTextcaptcha
  module TextcaptchaHelper

    # builds html form fields for the textcaptcha
    def textcaptcha_fields(f, &block)
      model        = f.object
      captcha_html = ''
      if model.perform_textcaptcha?
        if model.textcaptcha_key
          captcha_html += f.hidden_field(:textcaptcha_key)
          if model.textcaptcha_question
            captcha_html += capture(&block)
          elsif model.textcaptcha_answer
            captcha_html += f.hidden_field(:textcaptcha_answer)
          end
        end
      end

      # Rails 2 compatability
      if Rails::VERSION::MAJOR < 3
        concat captcha_html, &block.binding
      else
        captcha_html.html_safe
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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