[英]How can I add a video using the video_tag helper on my sign_in devise page?
[英]Using Devise, how can I set the root page to not redirect to the “sign_in” page if the user is logged out?
我想用數據庫中的某些項目填充根頁面,並且只有鏈接可以登錄頁面上的某處。 基本上,我不想讓登錄用戶獨享該內容。
在您的根控制器中,只需添加:
skip_before_filter :authenticate_user!
例:
class RootController < ApplicationController
skip_before_filter :authenticate_user!
def index
#some logic here
end
end
您還可以將其限制為僅索引操作:
skip_before_filter :authenticate_user!, only: [:index]
祝好運!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.