5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-06-29 14:16:07 +00:00

no generar excepciones en rutas inexistentes

This commit is contained in:
f 2020-06-17 10:40:59 -03:00
parent 55a250d5a2
commit e89c156ff4
2 changed files with 9 additions and 0 deletions

View file

@ -7,6 +7,8 @@ module Api
protect_from_forgery with: :null_session
respond_to :json
rescue_from ActionController::RoutingError, with: :page_not_found
private
# Realiza la inversa de Site#hostname
@ -31,6 +33,11 @@ module Api
def default_site
Site.first
end
# Muestra una página 404
def page_not_found
render 'application/page_not_found', status: :not_found
end
end
end
end

View file

@ -8,6 +8,8 @@ class ApplicationController < ActionController::Base
before_action :configure_permitted_parameters, if: :devise_controller?
around_action :set_locale
rescue_from ActionController::RoutingError, with: :page_not_found
before_action do
Rack::MiniProfiler.authorize_request if current_usuarie.try(:ends_with?, '@' + ENV.fetch('SUTTY', 'sutty.nl'))
end