Ruby on rails 自定义用户身份验证!轨道设计方法

Ruby on rails 自定义用户身份验证!轨道设计方法,ruby-on-rails,authentication,ruby-on-rails-4,devise,Ruby On Rails,Authentication,Ruby On Rails 4,Devise,我的用户模型上有一个布尔属性“boss”,如何创建自定义用户!在my before_filter中,以便只有user.boss==true的用户才能进行身份验证?对于您所说的要求,您应该覆盖Desive gem的会话控制器,而不是对_用户进行身份验证! before_filter do redirect_to root_path unless current_user && current_user.boss? end

我的用户模型上有一个布尔属性“boss”,如何创建自定义用户!在my before_filter中,以便只有user.boss==true的用户才能进行身份验证?

对于您所说的要求,您应该覆盖Desive gem的会话控制器,而不是对_用户进行身份验证!
before_filter do 
    redirect_to root_path unless current_user && current_user.boss?
end