Anulando un tipo MIME en Rails
-
01-07-2019 - |
Pregunta
Quiero anular el tipo JSON MIME ("application/json") en Rails a ("text/x-json").Intenté registrar el tipo MIME nuevamente en mime_types.rb pero no funcionó.¿Alguna sugerencia?
Gracias.
Solución
Esto debería funcionar (en un inicializador, complemento o algún lugar similar):
Mime.send(:remove_const, :JSON)
Mime::Type.register "text/x-json", :json
Otros consejos
Intentar:
render :json => var_containing_my_json, :content_type => 'text/x-json'
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow