Integration of Google reCaptcha with Rails application by Jay October 10, 2012 < 1 Minute ReadReCaptcha is a powerful captcha service to be use with a form to stop spam. This blog demonstrates the use of reCaptcha in rails application. Here I have used the ruby version 1.9.3 and Rails version 3.2.8EnvironmentRuby version – 1.9.3Rails – 3.2.8Step#1Create an account with recaptcha “http://www.google.com/recaptcha” and register your site name with your google account to retrieve public and private key that will be used later on the applicationStep#2 Installation of recaptchaGemOpen your Gemfile and add this codegem 'recaptcha', :require => 'recaptcha/rails'Pluginrails plugin install git://github.com/ambethia/recaptcha.gitStep#3Create a file named recaptcha.rb in RAILS_ROOT/config/initializer and fill it with these codesENV['RECAPTCHA_PUBLIC_KEY'] = 'youractualpublickey' ENV['RECAPTCHA_PRIVATE_KEY'] = 'youractualprivatekey'Step#4Usages Open your views file and add this code<%= recaptcha_tags %>Step#5Validation In controller, you can check the captcha validation by the followingif @model.save && verify_recaptcha(:model => @developer, :message => "Oh! It's error with reCAPTCHA!") #captcha is valid else #captcha is invalid endRelated Posts: How to Upload a File in Rails using CarrierWave Usage of PDFKit with Rails 3.2.8 and Ruby 1.9.3 Rails 5 – Most Effective Features for Apps UpgradationTags: Rails, Rails App Jayadev Das email@example.comDo what you do best in – that’s what I’ve always believed in and that’s what I preach. Over the past 25+ years (yup that’s my expertise ‘n’ experience in the Information Technology domain), I’ve been consulting to small, medium and large companies ‘bout Web Technologies, Mobile Future as well as on the good-and-bad of tech. Blogger, International Business Advisor, Web Technology Expert, Sales Guru, Startup Mentor, Insurance Sales Portal Expert & a Tennis Player. And top of all – a complete family man!