diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 9b5009da..7c60b953 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -33,7 +33,7 @@ private def require_user unless authenticated? flash[:warning] = "You must be logged in." - store and redirect_to new_session_path + store_location and redirect_to new_user_session_path return false end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 13af08f8..a554b810 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -2,10 +2,7 @@ class UsersController < ApplicationController before_filter :require_user, only: [:edit, :update] - respond_to :html, :json - - autocomplete :user, :name, :full => true - + respond_to :html, :json # GET /user/edit def edit @@ -24,7 +21,7 @@ class UsersController < ApplicationController @user.save - respond_with(@user, location: user_url(@user)) do |format| + respond_with(@user, location: session[:previous_url]) do |format| end end