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



13
14
15
# File 'lib/rack/passbook/models/registration.rb', line 13

def before_validation
  normalize_push_token! if self.push_token
end

#validateObject



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

def validate
  super

  validates_presence :device_library_identifier
  validates_unique [:device_library_identifier, :pass_id]
  validates_format /[[:xdigit:]]+/, :push_token
  validates_exact_length 40, :push_token
end