call create! with a block
def self.create_with_omniauth(auth)
create! do |user|
user.provider = auth["provider"]
user.uid = auth["uid"]
user.name = auth["user_info"]["name"]
end
end
This is useful as it allows us to modify the new user before it’s saved to the database and because it returns the new user
沒有留言:
張貼留言