Skip to content

Instantly share code, notes, and snippets.

@kixorz
Last active December 14, 2015 18:09
Show Gist options
  • Select an option

  • Save kixorz/5127099 to your computer and use it in GitHub Desktop.

Select an option

Save kixorz/5127099 to your computer and use it in GitHub Desktop.
Globally Handling Not Found in Rails with Mongoid
class ApplicationController < ActionController::Base
rescue_from Mongoid::Errors::DocumentNotFound, :with => :rescue_not_found
protected
def rescue_not_found
render :template => 'application/not_found', :status => :not_found
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment