From fcc55cc3ce9bffca8c78805f0811ce49612298b0 Mon Sep 17 00:00:00 2001 From: Jeremy Prevost Date: Thu, 17 Mar 2016 15:05:17 -0400 Subject: [PATCH] Redirect user to current page after sign in closes #98 --- app/controllers/application_controller.rb | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 9c20a99..4934f6f 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -2,6 +2,11 @@ class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you may want to use :null_session instead. protect_from_forgery with: :exception + before_filter :store_current_location, :unless => :devise_controller? + + def store_current_location + store_location_for(:user, request.url) + end rescue_from CanCan::AccessDenied do |exception| redirect_to root_url, alert: exception.message