RailsCasts Pro episodes are now free!

Learn more or hide this

dgarzon's Profile

GitHub User: dgarzon

Comments by

Avatar

Hi guys, I have been trying to get everything mentioned in the video but for some reason I can't get my omniauth data stored in a session for when a new user registers. Everything else works, I can add an authentication to a user and sign in with it.

in authentications_controller.rb I have:

def create

...

  else
    session[:auth] = auth.except('extra')
    redirect_to new_user_registration_path
  end

end

in registrations_controller.rb I have

def build_resource(*args)
super
if session[:omniauth]
@user.apply_omniauth(session[:omniauth])
@user.valid?
session[:omniauth] = nil
end
end

In the terminal log I can see that the authentications for the user are getting built but once the user registers the authentication does not save and he has to add it again. What am I doing wrong? I can't figure it out!

Thanks in advance.