What's the difference between render head :ok
vs. render status :ok
in Rails? They both get returned as the header right?
There is no difference really. The Rails doc says this about head
:
The head method can be used to send responses with only headers to the browser. The head method accepts a number or symbol (see reference table) representing an HTTP status code
head :ok
sets render to return just the header with status 200.
It's merely a shorthand for render nothing: true, status: :ok
.
Rails 5 will also do head :no_content
by default when you don't have a template defined for an action