How do you route [OPTIONS] in Rails?

activerecord, rest, routes, ruby-on-rails-3

Solution

match '/users' => "users#options", via: :options

would also be a possible route if placed before the other routes.

Problem

I am making a REST service in Rails. Here are my routes. ``` resources :users match '/users', :controller => 'users', :action => 'options', :constraints => {:method => 'OPTIONS'} ``` I am able to [GET] my users. I am trying to update my users and I get an error: ``` ActionController::RoutingError (No route matches [OPTIONS] "/users/1"): ``` When I run `rake routes` here are the routes that I am given: ``` users GET /users(.:format) users#index POST /users(.:format) users#create new_user GET /users/new(.:format) users#new edit_user GET /users/:id/edit(.:format) users#edit user GET /users/:id(.:format) users#show PUT /users/:id(.:format) users#update DELETE /users/:id(.:format) users#destroy /users(.:format) users#options {:method=>"OPTIONS"} ``` Could someone please show me how to fix my routes so I can make any kind of REST call? Thanks.

Original source

Related problems