Skip to content

Instantly share code, notes, and snippets.

@cjheath
Created August 9, 2011 05:34
Show Gist options
  • Select an option

  • Save cjheath/1133467 to your computer and use it in GitHub Desktop.

Select an option

Save cjheath/1133467 to your computer and use it in GitHub Desktop.
class Authentication
include DataMapper::Resource
belongs_to :user
property :id, Serial
property :user_id, Integer
property :provider, String
property :uid, String, :length => 240
property :user_name, String, :length => 240
property :user_email, String, :length => 240
end
require 'uuidtools'
class Project
include DataMapper::Resource
property :id, UUID, :key => true, :required => true, :default => proc { UUIDTools::UUID.random_create }
property :name, String
has 1, :user
end
class User
include DataMapper::Resource
devise :registerable, # handles signing up users through a registration process, also edit/destroy account.
:rememberable, # "Remember me" from a cookie
:trackable # Tracks sign in count, timestamps and IP address
property :id, Serial
# Each user may log in using different methods:
has n, :authentications
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment