开发者

Is it possible to enforce a controller method to work only for specific HTTP methods?

开发者 https://www.devze.com 2023-01-02 16:04 出处:网络
I was wondering if there was a way to make controller methods in rails ava开发者_如何学Goilable only for specific HTTP methods (GET, POST, etc.).

I was wondering if there was a way to make controller methods in rails ava开发者_如何学Goilable only for specific HTTP methods (GET, POST, etc.).

I guess I can create a filter to do that but it seems to me that it is something that is available out-of-the-box in rails.

Is it?


Yes. See http://guides.rubyonrails.org/routing.html section 3.11.1. You can specify what method should be accepted for each route.

0

精彩评论

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