0
class UserSessionsController < ApplicationController
skip_before_action :require_login, except: [:destroy]
def new
...
end
def create
...
end
def destroy
logout
redirect_to signin_path , flash: { info: 'Bye!' }
end
end
class ApplicationController < ActionController::Base
before_action :require_login
private
def not_authenticated
redirect_to signin_path, flash: { danger: "ALARM!" }
end
end
註銷後,我被重定向到登錄頁面,並顯示「ALARM」消息。 之後,當我再次登錄時,我被重定向到登錄頁面,並顯示「再見!爲什麼Session#Destroy觸發not_authenticated動作?
請幫忙!