3
4
5
6
7
8
9
10
11
12
13
|
# File 'lib/active_validation/validators/coordinate_validator.rb', line 3
def validate_each(record, attribute, value)
boundary = options.fetch(:boundary, :coordinate)
unless BOUNDARIES.include?(boundary)
raise ArgumentError,
"Unknown boundary: #{boundary.inspect}. Valid boundaries are: #{BOUNDARIES.map(&:inspect).join(', ')}"
end
unless valid?(value, options)
record.errors[attribute] << (options[:message] || I18n.t("active_validation.errors.messages.coordinate.#{boundary}"))
end
end
|