Class: Rack::Passbook::Registration

Inherits:
Sequel::Model
  • Object
show all
Defined in:
lib/rack/passbook/models/registration.rb

Instance Method Summary collapse

Instance Method Details

#before_validationObject


15
16
17
# File 'lib/rack/passbook/models/registration.rb', line 15

def before_validation
  normalize_push_token! if push_token
end

#validateObject


19
20
21
22
23
24
25
26
# File 'lib/rack/passbook/models/registration.rb', line 19

def validate
  super

  validates_presence :device_library_identifier
  validates_unique %i[device_library_identifier pass_id]
  validates_format /[[:xdigit:]]+/, :push_token
  validates_exact_length 64, :push_token
end