Module: CustomCaptcha::ActiveRecordExtension::InstanceMethods
- Defined in:
- lib/custom_captcha/active_record_extension.rb
Instance Method Summary collapse
Instance Method Details
#after_initialize ⇒ Object
22 23 24 |
# File 'lib/custom_captcha/active_record_extension.rb', line 22 def after_initialize self.custom_captcha_key ||= choice_image_file_path_and_write_cache end |
#custom_captcha_need_valid? ⇒ Boolean
32 33 34 |
# File 'lib/custom_captcha/active_record_extension.rb', line 32 def custom_captcha_need_valid? !CustomCaptcha::Configuration.disable? and !Rails.env.test? end |
#valid_custom_captcha ⇒ Object
26 27 28 29 30 |
# File 'lib/custom_captcha/active_record_extension.rb', line 26 def valid_custom_captcha unless CustomCaptcha::Utils.captcha_value_valid?(custom_captcha, read_captcha_digested()) errors.add(:custom_captcha, I18n.t('custom_captcha.message')) end end |