mirror of
https://github.com/ditkrg/validates_timeliness.git
synced 2026-01-22 22:06:45 +00:00
use the value from validates_each in validator
This commit is contained in:
parent
a1ae5f9313
commit
7ef9078369
@ -55,7 +55,7 @@ module ValidatesTimeliness
|
||||
configuration.delete(:allow_nil)
|
||||
configuration.delete(:allow_blank)
|
||||
validates_each(attr_names, configuration) do |record, attr_name, value|
|
||||
validator.call(record, attr_name)
|
||||
validator.call(record, attr_name, value)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -32,8 +32,7 @@ module ValidatesTimeliness
|
||||
validate_options(@configuration)
|
||||
end
|
||||
|
||||
def call(record, attr_name)
|
||||
value = record.send(attr_name)
|
||||
def call(record, attr_name, value)
|
||||
value = record.class.parse_date_time(value, type, false) if value.is_a?(String)
|
||||
raw_value = raw_value(record, attr_name)
|
||||
|
||||
|
||||
@ -500,7 +500,7 @@ describe ValidatesTimeliness::Validator do
|
||||
|
||||
def validate_with(attr_name, value)
|
||||
person.send("#{attr_name}=", value)
|
||||
validator.call(person, attr_name)
|
||||
validator.call(person, attr_name, value)
|
||||
end
|
||||
|
||||
def should_have_error(attr_name, error)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user