1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
class Token < CouchRest::Model::Base use_database :tokens property :user_id, String, accessible: false validates :user_id, presence: true def initialize(*args) super self.id = SecureRandom.urlsafe_base64(32) end design do end end