rest - Add verbs to resources of Rails's routing -
by default, resources
keyword of rails routing creates 7 actions.
for example resources :foos
:
----------------------- | verb | action | ----------------------- | | index | | | show | | | edit | | | new | | put/patch | update | | post | create | | delete | destroy | -----------------------
how can add inside list options
verb such as:
-------------------------------- | verb | action | -------------------------------- | ... | ... | | options | member_options | | options | collection_options | --------------------------------
in other words, default, each resource, have use this:
match '/foos/', via: :options, controller: 'foos', action: 'collection_options' match '/foos/:id/', via: :options, controller: 'foos', action: 'member_options', as: :foo resources :foos
instead, prefer custom settings in order this:
resources :foos
to avoid listing every path options verb, add catch route, e.g.
match '*path', to: 'application#cors_preflight_check', via: [:options]
Comments
Post a Comment