Skip to content

Instantly share code, notes, and snippets.

@shuma
Created February 28, 2013 15:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shuma/5057369 to your computer and use it in GitHub Desktop.
Save shuma/5057369 to your computer and use it in GitHub Desktop.
class SessionsController < ApplicationController
after_filter :after_sign_in_path, :only => [:create]
def create
user = User.from_omniauth(env["omniauth.auth"])
session[:user_id] = user.id
redirect_to :back
end
def destroy
session[:user_id] = nil
redirect_to :back
end
private
def after_sign_in_path
if session[:review]
Review.create!(:content => session[:review][:content], :school_id => session[:review][:school_id], :user_id => current_user.id, :rating => session[:review][:rating])
#cleanup
session[:review] = nil
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment