Skip to content

Instantly share code, notes, and snippets.

@xionon
Created May 12, 2014 17:54
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 xionon/d055b8ed4c972dca18e7 to your computer and use it in GitHub Desktop.
Save xionon/d055b8ed4c972dca18e7 to your computer and use it in GitHub Desktop.
class ApplicationController < ActionController::Base
# see: http://guides.rubyonrails.org/action_controller_overview.html#rescue-from
rescue_from ApiKey::NotAuthorized, with: :api_key_not_authorized
rescue_from ActiveRecord::RecordNotFound, with: :record_not_found
private
# see: http://guides.rubyonrails.org/layouts_and_rendering.html#options-for-render
def record_not_found
render file: '404.html', status: :not_found
end
def api_key_not_allowed
render file: 'not_authorized.html', status: :unauthorized
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment