asciinema.org/app/models/user.rb

18 lines
456 B
Ruby
Raw Normal View History

class User < ActiveRecord::Base
validate :provider, :presence => true
validate :uid, :presence => true
2012-02-26 19:11:09 +00:00
validate :nickname, :presence => true
def self.create_with_omniauth(auth)
create! do |user|
user.provider = auth["provider"]
user.uid = auth["uid"]
2012-02-26 19:11:09 +00:00
user.nickname = auth["info"]["nickname"]
user.name = auth["info"]["name"]
user.avatar_url = OauthHelper.get_avatar_url(auth)
end
end
end