According to the rails source, this is done under the hood when passing nothing: true
in rails 5.
if options.delete(:nothing)
ActiveSupport::Deprecation.warn("`:nothing` option is deprecated and will be removed in Rails 5.1. Use `head` method to respond with empty response body.")
options[:body] = nil
end
Just replacing nothing: true
with body: nil
should therefore solve the problem.
class PagesController < ApplicationController
def action
render body: nil
end
end
alternatively you can use head :ok
class PagesController < ApplicationController
def action
head :ok
end
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With