Here it is, a simple captcha for Rails applications.
To set up, add the following line to your Gemfile
gem "galetahub-simple_captcha", :require => "simple_captcha"
Run rails generator
rails generate simple_captcha
Do db Migration
rake db:migrate -t
In your view file add
%= show_simple_captcha %
Add the following in yml file
en.yml:
en: simple_captcha: label: "Enter the above code" placeholder: "Enter here"
In controller just include captcha helpers module
class ApplicationController < ActionController::Base include SimpleCaptcha::ControllerHelpers end
Use this code in the controller for the captcha validation
if simple_captcha_valid? do this else do that end