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
我退出后,我被重定向到使用flash消息&#34; ALARM&#34;登录页面。 之后,当我再次登录时,我被重定向到使用flash消息登录页面&#34;再见!&#34;
请帮忙!
答案 0 :(得分:0)
require_login
会话之前跳过destroy