Sha256: 2d5a738175ee25c0c97d415887ad8bbae1103716198194db0279c6a00561d449

Contents?: true

Size: 271 Bytes

Versions: 5

Compression:

Stored size: 271 Bytes

Contents

class LongitudeValidator < ActiveModel::EachValidator

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

end

Version data entries

5 entries across 5 versions & 1 rubygems

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