Skip to content

Instantly share code, notes, and snippets.

@mxmzb
Created January 13, 2015 02:47
Show Gist options
  • Save mxmzb/67761d681fbc9fbf151e to your computer and use it in GitHub Desktop.
Save mxmzb/67761d681fbc9fbf151e to your computer and use it in GitHub Desktop.
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :confirmable, :lockable, :timeoutable and :omniauthable
devise :recoverable, :rememberable, :trackable, #:validatable,
:omniauthable, :omniauth_providers => [:steam]
#:database_authenticatable, :registerable,
def self.from_omniauth(auth)
where(steam_id: auth.uid).first_or_create do |user|
user.steam_id = auth.uid
user.steam_username = auth.extra.raw_info.profileurl.split("/").last # assuming the user model has a name
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment