Class: Rpush::Client::ActiveModel::Apns::DeviceTokenFormatValidator

Inherits:
ActiveModel::Validator
  • Object
show all
Defined in:
lib/rpush/client/active_model/apns/device_token_format_validator.rb

Instance Method Summary collapse

Instance Method Details

#validate(record) ⇒ Object



6
7
8
9
# File 'lib/rpush/client/active_model/apns/device_token_format_validator.rb', line 6

def validate(record)
  return if record.device_token =~ /\A[a-z0-9]\w+\z/i
  record.errors.add :device_token, "is invalid"
end