Skip to content

Instantly share code, notes, and snippets.

@harssh
Forked from alecslupu/gist:1375139
Created April 25, 2024 00:52
Show Gist options
  • Save harssh/2015ea47f61b44c2d82c8f672d18e4ba to your computer and use it in GitHub Desktop.
Save harssh/2015ea47f61b44c2d82c8f672d18e4ba to your computer and use it in GitHub Desktop.
module Devise
module Models
# Registerable is responsible for everything related to registering a new
# resource (ie user sign up).
module Registerable
extend ActiveSupport::Concern
module ClassMethods
# A convenience method that receives both parameters and session to
# initialize a user. This can be used by OAuth, for example, to send
# in the user token and be stored on initialization.
#
# By default discards all information sent by the session by calling
# new with params.
def new_with_session(params, session)
user = new(params)
if data = session["devise.facebook_data"]
user.email = data["user_info"]["email"]
end
user
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment