Sha256: b2f811c4c7aca89866afe1fd3ea0308bef7a8795586979c0809dc15e9cdca1e3

Contents?: true

Size: 267 Bytes

Versions: 5

Compression:

Stored size: 267 Bytes

Contents

class LatitudeValidator < ActiveModel::EachValidator

  def validate_each(record, attribute, value)
    unless value.present? && value >= -90 && value <= 90
      record.errors[attribute] << (options[:message] || I18n.t('errors.messages.latitude'))
    end
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
flash_validators-3.0.1 lib/flash_validators/validators/latitude_validator.rb
flash_validators-3.0.0 lib/flash_validators/validators/latitude_validator.rb
flash_validators-1.1.0 lib/flash_validators/validators/latitude_validator.rb
flash_validators-1.0.0 lib/flash_validators/validators/latitude_validator.rb
flash_validators-0.0.1 lib/flash_validators/validators/latitude_validator.rb