まずため
おかげで、私はこれを自分でしないだろう。
本当にこの自分を行うにはしたくない場合は、私はすべてのアクションの前に呼び出されますあなたのApplicationController
でuser_logged_in!
方法を行うだろう、が、(あなたがbefore_action
でチェックすべきアクションを選択することができます):
class ApplicationController < BaseController
before_action :user_logged_in!
protected
def user_logged_in!
# Logic that checks if the user is actually logged in (check in session, etc).
# If not logged in, redirect the user to the root page with a flash message.
end
end
ユーザーが認証される必要はありませんアクション/コントローラの場合
、あなたがskip_before_action
を使用することができます。
class DomainsController < BaseController
skip_before_action :user_logged_in!, only: [:index, :show]
end
それが否決されたのはなぜ? – Felix