: via => [: options] in ruby ββalong rails
According to the HTTP specification (and explained a little more here ), there is the verb OPTIONS - which routes can support.
The impulse to use OPTIONS is to request documentation for the web service API; The results are intended to provide information on how to use the API.
ActionDispatch::Routing::HTTP_METHODS => [:get, :head, :post, :put, :delete, :options] To get back to your question, the first route will be used in a typical browser GET request. When the OPTIONS request is executed, the second route will be used.
You can use the: via option to restrict the request to one or more HTTP methods.
See the routing guide for routing.
:post :get :put :delete :options :head and :any allowed as the value for this option.
As explained in the blog post , OPTIONS is another HTTP verb to support CORS Requests (a way to make AJAX requests for cross domains).
Refresh found a blog post explaining :options