Module: MathCaptcha::ViewHelper

Defined in:
lib/math_captcha/view.rb

Instance Method Summary collapse

Instance Method Details

#show_math_captcha(options = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# 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