Rails: How to disallow access to new, delete, edit URL for a resource?
I know Rails generate new, delete, and edit, and whatever the other is for all resources. So if you have a model user, you can go to /user/1, etc. But I want all of these auto-generated urls to be disallowed 开发者_运维百科access? How do I do that?
You can restrict the routes when you say resources :users:
resources :users, :only => [ :index, :show ]
Change your config/routes.rb file by removing map.resources :users and just add the route that you need.
 
         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论