Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Overriding a MIME type in Rails

I want to override the JSON MIME type ("application/json") in Rails to ("text/x-json"). I tried to register the MIME type again in mime_types.rb but that didn't work. Any suggestions?

Thanks.

like image 907
JP Richardson Avatar asked Dec 10 '22 23:12

JP Richardson


1 Answers

This should work (in an initializer, plugin, or some similar place):

Mime.send(:remove_const, :JSON)
Mime::Type.register "text/x-json", :json
like image 57
Ben Scofield Avatar answered Dec 31 '22 10:12

Ben Scofield