vendor/plugins/validates_captcha/lib/add_captcha_to_action_controller.rb
# Verify a CAPTCHA challenge. You must
# supply the ID and the user-contributed
# validation (from params). It returns
# false when the validation fails, and nil
# when the challenge can't be found. Both
# nil and false are false in a Boolean context,
# so you only have to care about that if you want
# to differentiate between the two.
# 
# This method is meant as an alternative to the
# ActiveRecord extension +validates_captcha+, thus
# keeping your model happily ignorant of the CAPTCHA
# logic which really belongs in the controller.
Verify a CAPTCHA challenge. You must
supply the ID and the user-contributed
validation (from params). It returns
false when the validation fails, and nil
when the challenge can't be found. Both
nil and false are false in a Boolean context,
so you only have to care about that if you want
to differentiate between the two.

This method is meant as an alternative to the
ActiveRecord extension +validates_captcha+, thus
keeping your model happily ignorant of the CAPTCHA
logic which really belongs in the controller.
Verify a CAPTCHA challenge . You must supply the ID and the user - contributed validation ( from params ) . It returns false when the validation fails and nil when the challenge can ' t be found . Both nil and false are false in a Boolean context so you only have to care about that if you want to differentiate between the two . This method is meant as an alternative to the ActiveRecord extension + validates_captcha + thus keeping your model happily ignorant of the CAPTCHA logic which really belongs in the controller .
def captcha_valid?(captcha_id, captcha_validation) 
          captcha = CaptchaChallenge.find(captcha_id)
          if captcha
            if captcha.correct?(captcha_validation)
              true
            else
              false
            end
          else
            nil
          end
        end
def captcha_valid? ( captcha_id , captcha_validation ) captcha = CaptchaChallenge . find ( captcha_id ) if captcha if captcha . correct? ( captcha_validation ) true else false end else nil end end
Verify a CAPTCHA challenge.
Verify a CAPTCHA challenge .
#:doc:
captcha_id
<not_specific>
captcha_validation
<not_specific>