donald
donald

Reputation: 23747

Rails 3: Set a route as 'get'

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?

Upvotes: 1

Views: 166

Answers (1)

iceydee
iceydee

Reputation: 1039

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

Upvotes: 1

Related Questions