module MathCaptcha::ViewHelper

Public Instance Methods

show_math_captcha(options = {}) click to toggle source
# File lib/math_captcha/view.rb, line 4
def show_math_captcha(options = {})
  options = sanitize_options(options)

  #key = visual_captcha_key('captcha')
  # captcha = VisualCaptcha::Captcha.new(number)
  # challenge = captcha.build
  captcha = MathCaptcha::Captcha.new
  challenge = captcha.build_challenge

  session[:captcha] = challenge.encrypted

  render :partial => 'math_captcha/math_captcha', :locals => { :captcha_options =>  options, :challenge => challenge }
end

Private Instance Methods

sanitize_options(options) click to toggle source
# File lib/math_captcha/view.rb, line 20
def sanitize_options(options)
  options
end