Module: ValidatesCaptcha::ModelValidation::InstanceMethods
- Defined in:
- lib/validates_captcha/model_validation.rb
Overview
:nodoc:
Instance Method Summary collapse
- #attributes_with_captcha_fields=(new_attributes, guard_protected_attributes = true) ⇒ Object
-
#captcha_challenge ⇒ Object
:nodoc:.
Instance Method Details
#attributes_with_captcha_fields=(new_attributes, guard_protected_attributes = true) ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/validates_captcha/model_validation.rb', line 51 def attributes_with_captcha_fields=(new_attributes, guard_protected_attributes = true) if new_attributes && guard_protected_attributes && (new_attributes.key?('captcha_challenge') || new_attributes.key?(:captcha_challenge)) attributes = new_attributes.dup attributes.stringify_keys! self.captcha_challenge = attributes.delete('captcha_challenge') self.captcha_solution = attributes.delete('captcha_solution') new_attributes = attributes end send :attributes_without_captcha_fields=, new_attributes, guard_protected_attributes end |
#captcha_challenge ⇒ Object
:nodoc:
46 47 48 49 |
# File 'lib/validates_captcha/model_validation.rb', line 46 def captcha_challenge #:nodoc: return @captcha_challenge unless @captcha_challenge.blank? @captcha_challenge = ValidatesCaptcha.provider.generate_challenge end |