开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜