Class: ActiveModel::Validations::ConfirmationValidator
- Inherits:
-
EachValidator
- Object
- ActiveModel::Validator
- EachValidator
- ActiveModel::Validations::ConfirmationValidator
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activemodel-7.0.4/lib/active_model/validations/confirmation.rb
Overview
:nodoc:
Instance Attribute Summary
Attributes inherited from EachValidator
Attributes inherited from ActiveModel::Validator
Instance Method Summary collapse
-
#initialize(options) ⇒ ConfirmationValidator
constructor
A new instance of ConfirmationValidator.
- #validate_each(record, attribute, value) ⇒ Object
Methods inherited from EachValidator
Methods inherited from ActiveModel::Validator
Constructor Details
#initialize(options) ⇒ ConfirmationValidator
Returns a new instance of ConfirmationValidator.
6 7 8 9 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activemodel-7.0.4/lib/active_model/validations/confirmation.rb', line 6 def initialize() super({ case_sensitive: true }.merge!()) setup!([:class]) end |
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/activemodel-7.0.4/lib/active_model/validations/confirmation.rb', line 11 def validate_each(record, attribute, value) unless (confirmed = record.public_send("#{attribute}_confirmation")).nil? unless confirmation_value_equal?(record, attribute, value, confirmed) human_attribute_name = record.class.human_attribute_name(attribute) record.errors.add(:"#{attribute}_confirmation", :confirmation, **.except(:case_sensitive).merge!(attribute: human_attribute_name)) end end end |