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.
精彩评论