简体   繁体   English

Ruby on Rails:devise:,我如何允许帖子/索引和帖子/显示操作对所有操作,但其他操作将被拒绝

[英]Ruby on rails: devise :, how can i allow posts/index and posts/show action to all but other actions will be denied

我如何允许其他人拒绝发布/索引和发布/显示操作,但其他操作将被拒绝?

在您的PostsController中

before_filter :authenticate_user!, :except => [:index, :show]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Ruby on Rails,设计:如何将用户表的ID添加到posts.user_id列? - Ruby on Rails, devise: How can i add the id of users table to posts.user_id column? Ruby On Rails Rolify + CanCanCan + Devise允许用户仅编辑其帖子 - Ruby On Rails Rolify + CanCanCan + Devise allow user to edit only their posts Ruby / Rails如何限制一个用户可以被其他用户看到的帖子数量? - Ruby/Rails How do I limit the number of posts a user can have seen by other users? Rails:在其他模型的show动作中创建新帖子 - Rails: Creating new posts in the other model's show action Ruby on Rails 4项目。 如何显示所有类别的所有帖子? - Ruby on Rails 4 Project. How to show all posts from all categories? 如何在Ruby on Rails中仅显示公共帖子而不显示私人帖子? - How to only show public posts and not show private ones in Ruby on Rails? Ruby on Rails:Devise + Cancan-如何编辑其他用户? - Ruby on Rails: Devise + Cancan - How can I edit other users? 我希望我的帖子在Ruby on Rails旁显示 - I want my posts to show next to eachother Ruby on Rails 如何显示所有带有所有评论的帖子-Ruby on Rails - How to display all posts with all its comments - Ruby on Rails 如何解决Ruby on Rails中的错误:“ Posts#index中的Sass :: SyntaxError”? - How to fix Error : “Sass::SyntaxError in Posts#index” in Ruby on Rails?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM