Skip to content

Instantly share code, notes, and snippets.

@madhums
Created November 16, 2010 03:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save madhums/701357 to your computer and use it in GitHub Desktop.
Save madhums/701357 to your computer and use it in GitHub Desktop.
omniauth and user models (this is just for demo)
#app/models/user.rb
class User < ActiveRecord::Base
has_many :authorizations, :dependent => :destroy
end
#app/models/authorization.rb
class Authorization < ActiveRecord::Base
belongs_to :user
validates_presence_of :user_id, :uid, :provider
validates_uniqueness_of :uid, :scope => :provider
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment