Skip to content

Instantly share code, notes, and snippets.

@yuki24
Created November 27, 2014 17:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yuki24/0a5eb15bc6197bf45e60 to your computer and use it in GitHub Desktop.
Save yuki24/0a5eb15bc6197bf45e60 to your computer and use it in GitHub Desktop.
Force-return a JSON response. Always.
class ApplicationController < ActionController::Base
before_filter :override_request_formats
def override_request_formats
request.formats = [:json]
end
...
end
YourApp::Application.configure do
...
config.consider_all_requests_local = false
...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment