开发者

Rails 3: Set a route as 'get'

开发者 https://www.devze.com 2023-03-04 22:21 出处:网络
I have a route as: match \'api/v1/:id/:format/:date/(:type)\', :controller => \"xpto\", :action => \"api_开发者_开发技巧xpto\"

I have a route as:

match 'api/v1/:id/:format/:date/(:type)', :controller => "xpto", :action => "api_开发者_开发技巧xpto"

The goal is to make it as a GET request from the outside. However, the route is not being set as a GET.

How can I make it a GET?


Change match to get:

get 'api/v1/:id/:format/:date/(:type)', :controller => "xpto", :action => "api_xpto"

Or add :via option

match 'api/v1/:id/:format/:date/(:type)', :controller => "xpto", :action => "api_xpto", :via => :get
0

精彩评论

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