Is there a way to globally define a rails app to only serve json and xml and appropriately error on any other requests?
I’m thinking it’s something along the lines of a before_filter and responds_to block in the ApplicationController but that’s as far as my investigation has got me.
Just declare it at the class level on your controller, using
respond_to. It will apply to all your controllers if you do it onApplicationControllerAlso read about
ActionController::Responderclass for more options.