Simple respond_with in rails that avoids 204 from PUT

前端 未结 6 492
有刺的猬
有刺的猬 2020-12-23 17:46

I want to PUT to rails and avoid getting a 204. I am using this pattern:

class SomeController < ApplicationController
  respond_         


        
6条回答
  •  一个人的身影
    2020-12-23 17:53

    Not a big fan of this behavior. To get around it, I had to avoid using the respond_with method:

    class SomeController < ApplicationController
      respond_to :json
    
      def update
        # ...
        respond_to do |format|
          format.json { render(json: some_object, status: 200) }
        end
      end
    end
    

提交回复
热议问题