From 9c353953504f17aa6706f8982dc60de5f6cf1a97 Mon Sep 17 00:00:00 2001 From: differentreality Date: Sun, 25 Aug 2013 13:40:44 +0300 Subject: [PATCH] redirect to requested page after login --- app/controllers/application_controller.rb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 80d74f93..57495640 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -2,6 +2,15 @@ class ApplicationController < ActionController::Base include ApplicationHelper protect_from_forgery before_filter :get_conferences + before_filter :store_location + + def store_location + session[:return_to] = request.fullpath if request.get? and controller_name != "user_sessions" and controller_name != "sessions" + end + + def after_sign_in_path_for(resource) + session[:return_to] + end def get_conferences @conferences =Conference.all