class Rack::PushNotification::Device

Public Instance Methods

before_validation() click to toggle source
# File lib/rack/push-notification/models/device.rb, line 14
def before_validation
  normalize_token!
end
validate() click to toggle source
Calls superclass method
# File lib/rack/push-notification/models/device.rb, line 18
def validate
  super

  validates_presence :token
  validates_unique :token
  validates_format /[[:xdigit:]]{40}/, :token
end

Private Instance Methods

normalize_token!() click to toggle source
# File lib/rack/push-notification/models/device.rb, line 28
def normalize_token!
  self.token = token.strip.gsub(/[<\s>]/, '')
end