diff options
Diffstat (limited to 'app/controllers/application_controller.rb')
-rw-r--r-- | app/controllers/application_controller.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 73de1838c..90e923951 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -7,8 +7,21 @@ class ApplicationController < ActionController::Base helper_method :current_account + rescue_from ActionController::RoutingError, with: :not_found + rescue_from ActiveRecord::RecordNotFound, with: :not_found + + def raise_not_found + raise ActionController::RoutingError.new("No route matches #{params[:unmatched_route]}") + end + protected + def not_found + respond_to do |format| + format.any { head 404 } + end + end + def current_account current_user.try(:account) end |