How to set default format for routing in Rails?

前端 未结 3 1894
南笙
南笙 2021-01-12 19:20

There is the following code for routing:

  resources :orders, only: [:create], defaults: { format: \'json\' }
  resources :users,  only: [:create, :update],          


        
3条回答
  •  [愿得一人]
    2021-01-12 20:19

    That worked for me:

      scope defaults: { format: 'json' } do
        resources :users, only: [:index]
      end
    

提交回复
热议问题