RailsCasts Pro episodes are now free!
Learn more or hide this
GitHub User: aswath87
did you miss the 'rails g controller sessions' by any chance?
Thanks for the great tutorials!
I've a question - I want an additional field (besides name, email) from the user for sign up that's not present in the 'auth' returned. So I'll have to redirect the user to a page with a form
to get the additional fields as inputs and then create the new user. Please let me know what's the best way to do this.
auth = request.env["omniauth.auth"]
user = User.find_by_provider_and_uid(auth["provider"], auth["uid"])
if (user == nil) #user doesn't exist in database, create new user
user = # directs to a page with a form for additional fields and use some info from auth to create new user. how do i do this?
session[user_id] = user.id
redirect_to root_url, :notice => "Signed in!"