When your application has a form that’s available to everyone for eg. Contact us, you will be spammed! So what can we do about it?
Well, one option is to have all forms secured by authentication… OR we can use a captcha. So, Here is how you can implement your own simple captcha in Ruby on Rails,
First of all we will create Captcha class in lib folder,
Here we are dumping the variables into a string using YAML and then encrypt/decrypt.