Class: RedisCaptcha::CaptchaController

Inherits:
ApplicationController show all
Defined in:
app/controllers/redis_captcha/captcha_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject



3
4
5
6
7
8
9
10
11
# File 'app/controllers/redis_captcha/captcha_controller.rb', line 3

def show
  captcha = RedisCaptcha::Image.new(session[:captcha_key])
  tempfile = captcha.generate
  if tempfile
    send_file(tempfile, :type => captcha.content_type, :disposition => 'inline', :filename => captcha.filename)
  else
    render :nothing => true
  end
end