I have a user registration form, and wanted to write a human detecting "captcha" into my register method. I decided to create a simple math question for users to answer (this should work for my purposes).
How do I write a validation that checks the value of this field? I wrote a validate method in my model file as follows:
def validate
errors.add(:humanproof, "is not the right answer") if humanproof != 4
end
However since :humanproof is not part of the user model, the "humanproof" variable isn't available there.
What is the best way to access the humanproof variable?