Class: MiniDefender::Rules::Confirmed
Class Method Summary
collapse
Instance Method Summary
collapse
#active?, available?, #bails?, #coerce, #default_value, #defaults?, #error_message, #excluded?, #force_coerce?, #implicit?, make, #priority, #stops?, #with_message
Constructor Details
Returns a new instance of Confirmed.
4
5
6
|
# File 'lib/mini_defender/rules/confirmed.rb', line 4
def initialize
@found = false
end
|
Class Method Details
.signature ⇒ Object
8
9
10
|
# File 'lib/mini_defender/rules/confirmed.rb', line 8
def self.signature
'confirmed'
end
|
Instance Method Details
#message(attribute, value, validator) ⇒ Object
17
18
19
20
21
22
23
|
# File 'lib/mini_defender/rules/confirmed.rb', line 17
def message(attribute, value, validator)
if @found
'The value confirmation does not match.'
else
'The value must be confirmed.'
end
end
|
#passes?(attribute, value, validator) ⇒ Boolean
12
13
14
15
|
# File 'lib/mini_defender/rules/confirmed.rb', line 12
def passes?(attribute, value, validator)
key = "#{attribute}_confirmation"
(@found = validator.data.key?(key)) && value == validator.data[key]
end
|