mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
parent
052f307b23
commit
95b45c826d
2 changed files with 4 additions and 4 deletions
|
@ -22,7 +22,7 @@ module ActiveModel
|
||||||
return record.errors.add(attr_name, :blank, **error_options(value, option_value))
|
return record.errors.add(attr_name, :blank, **error_options(value, option_value))
|
||||||
end
|
end
|
||||||
|
|
||||||
unless value.send(COMPARE_CHECKS[option], option_value)
|
unless value.public_send(COMPARE_CHECKS[option], option_value)
|
||||||
record.errors.add(attr_name, option, **error_options(value, option_value))
|
record.errors.add(attr_name, option, **error_options(value, option_value))
|
||||||
end
|
end
|
||||||
rescue ArgumentError => e
|
rescue ArgumentError => e
|
||||||
|
|
|
@ -46,16 +46,16 @@ module ActiveModel
|
||||||
|
|
||||||
options.slice(*RESERVED_OPTIONS).each do |option, option_value|
|
options.slice(*RESERVED_OPTIONS).each do |option, option_value|
|
||||||
if NUMBER_CHECKS.include?(option)
|
if NUMBER_CHECKS.include?(option)
|
||||||
unless value.to_i.send(NUMBER_CHECKS[option])
|
unless value.to_i.public_send(NUMBER_CHECKS[option])
|
||||||
record.errors.add(attr_name, option, **filtered_options(value))
|
record.errors.add(attr_name, option, **filtered_options(value))
|
||||||
end
|
end
|
||||||
elsif RANGE_CHECKS.include?(option)
|
elsif RANGE_CHECKS.include?(option)
|
||||||
unless value.send(RANGE_CHECKS[option], option_value)
|
unless value.public_send(RANGE_CHECKS[option], option_value)
|
||||||
record.errors.add(attr_name, option, **filtered_options(value).merge!(count: option_value))
|
record.errors.add(attr_name, option, **filtered_options(value).merge!(count: option_value))
|
||||||
end
|
end
|
||||||
elsif COMPARE_CHECKS.include?(option)
|
elsif COMPARE_CHECKS.include?(option)
|
||||||
option_value = option_as_number(record, option_value, precision, scale)
|
option_value = option_as_number(record, option_value, precision, scale)
|
||||||
unless value.send(COMPARE_CHECKS[option], option_value)
|
unless value.public_send(COMPARE_CHECKS[option], option_value)
|
||||||
record.errors.add(attr_name, option, **filtered_options(value).merge!(count: option_value))
|
record.errors.add(attr_name, option, **filtered_options(value).merge!(count: option_value))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue