mirror of
https://0xacab.org/sutty/sutty
synced 2025-01-19 23:13:38 +00:00
no generar excepciones en rutas inexistentes
This commit is contained in:
parent
55a250d5a2
commit
e89c156ff4
2 changed files with 9 additions and 0 deletions
|
@ -7,6 +7,8 @@ module Api
|
||||||
protect_from_forgery with: :null_session
|
protect_from_forgery with: :null_session
|
||||||
respond_to :json
|
respond_to :json
|
||||||
|
|
||||||
|
rescue_from ActionController::RoutingError, with: :page_not_found
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
# Realiza la inversa de Site#hostname
|
# Realiza la inversa de Site#hostname
|
||||||
|
@ -31,6 +33,11 @@ module Api
|
||||||
def default_site
|
def default_site
|
||||||
Site.first
|
Site.first
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Muestra una página 404
|
||||||
|
def page_not_found
|
||||||
|
render 'application/page_not_found', status: :not_found
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,6 +8,8 @@ class ApplicationController < ActionController::Base
|
||||||
before_action :configure_permitted_parameters, if: :devise_controller?
|
before_action :configure_permitted_parameters, if: :devise_controller?
|
||||||
around_action :set_locale
|
around_action :set_locale
|
||||||
|
|
||||||
|
rescue_from ActionController::RoutingError, with: :page_not_found
|
||||||
|
|
||||||
before_action do
|
before_action do
|
||||||
Rack::MiniProfiler.authorize_request if current_usuarie.try(:ends_with?, '@' + ENV.fetch('SUTTY', 'sutty.nl'))
|
Rack::MiniProfiler.authorize_request if current_usuarie.try(:ends_with?, '@' + ENV.fetch('SUTTY', 'sutty.nl'))
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue