Ruby on rails 3 在RoR中使用Desive-如何只拥有几页而不需要登录-覆盖用户身份验证

Ruby on rails 3 在RoR中使用Desive-如何只拥有几页而不需要登录-覆盖用户身份验证,ruby-on-rails-3,authentication,devise,Ruby On Rails 3,Authentication,Devise,对于我的大多数网站,我想要求登录。但是对于两个页面,我需要有一个用户能够提交到该页面而无需登录 有没有一种方法可以覆盖 before_filter :authenticate_user! 我将其放入应用程序控制器中?在所需的控制器中,添加: before_filter :authenticate_user!, :except => [:action_name_1, :action_name_2] skip_before_filter :authenticate_user!, :only

对于我的大多数网站,我想要求登录。但是对于两个页面,我需要有一个用户能够提交到该页面而无需登录

有没有一种方法可以覆盖

before_filter :authenticate_user!

我将其放入应用程序控制器中?

在所需的控制器中,添加:

before_filter :authenticate_user!, :except => [:action_name_1, :action_name_2]
skip_before_filter :authenticate_user!, :only => [:some_action, :another_action]

上阅读有关过滤器的更多信息是的,我就是这么做的。我应该提一下。