Skip to content

Instantly share code, notes, and snippets.

@maxgillett
Created August 1, 2012 20:19
Show Gist options
  • Save maxgillett/3230352 to your computer and use it in GitHub Desktop.
Save maxgillett/3230352 to your computer and use it in GitHub Desktop.
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable,
# :lockable, :timeoutable and :omniauthable
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable, :validatable,
:omniauthable
# Setup accessible (or protected) attributes for your model
attr_accessible :email, :password, :password_confirmation, :remember_me
has_many :playlists
has_many :authentications
def apply_omniauth(auth)
self.email = auth['extra']['raw_info']['email']
authentications.build(:provider => auth['provider'], :uid => auth['uid'], :token => auth['extension']['token'])
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment