开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜