gem install sinatra-captcha
require 'rubygems'
require 'sinatra'
require 'sinatra/captcha'
get '/' do
erb :captcha
end
post '/' do
halt(401, "invalid captcha") unless captcha_pass?
"passed!"
end
__END__
@@ captcha
Catcha Example
<%= captcha_image_tag %>
<%= captcha_answer_tag %>
Thank you to ERR THE BLOG for inspiration: http://errtheblog.com/posts/43-captchator-on-rails