Configuration

[sudo] gem install rack-captchator


## Gemfile
gem 'rack-captchator', :require => 'rack/captchator'

Add the middleware in your app file

Sinatra-like frameworks

## app.rb
use Rack::Captchator
helpers Rack::Captchator::Helpers

Example

## form.haml
%form{:action => '/someroute', :method => 'post'}
   = captcha_image_tag
   = captha_answer_tag
   %input{:type => "submit", :value => "submit"}


## app.rb
post '/someroute' do
  if captcha_valid?
    # your logic when it passed
  else
    # your logic when it failed
  end
end

Copyright

Copyright (c) 2011 nyash. See LICENSE for details.