We have a controller action which has a error handling state.
However eventhough the js is rendered, the response content-type is still "text/html". (The request
Accept is set to
) This is very puzzling to us, because this always worked for us.
Later we found out that the root cause was because we call
render_to_string. If we remove that call, Rails will again be able to guess the content-type as
render_to_string is called, eventhough it is not directly used by the response rendering.
respond_to would also solve this issue, forcing Rails to return
I guess we should always specify
respond_to, so the content-type can be deterministic.