Skip to content

Instantly share code, notes, and snippets.

View grauschnabel's full-sized avatar

Martin Kaffanke grauschnabel

View GitHub Profile
@grauschnabel
grauschnabel / api key
Created February 16, 2014 19:05
api key
class ApiKey < ActiveRecord::Base
belongs_to :user
around_create :generate_api_key
def generate_api_key
self.api_key = ""
chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_-.,"