diff options
author | Azul <azul@riseup.net> | 2016-03-31 11:40:44 +0200 |
---|---|---|
committer | Azul <azul@riseup.net> | 2016-03-31 11:40:44 +0200 |
commit | be5efb57dc9b282a31cf29c9eac27cb5a7e7ac2f (patch) | |
tree | ce8bee7d2fa4007a1db9815e1af001fe44e329c1 /app/controllers/controller_extension/errors.rb | |
parent | 14c9f2ab7cbf410bcd7fdd75b4a1c11417b30bd7 (diff) | |
parent | 48acca107b9bd7a59bacb1449b042eb753e63917 (diff) |
Merge remote-tracking branch 'github/211' into develop
Diffstat (limited to 'app/controllers/controller_extension/errors.rb')
-rw-r--r-- | app/controllers/controller_extension/errors.rb | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/app/controllers/controller_extension/errors.rb b/app/controllers/controller_extension/errors.rb index 8f8edde..3d919b0 100644 --- a/app/controllers/controller_extension/errors.rb +++ b/app/controllers/controller_extension/errors.rb @@ -4,21 +4,25 @@ module ControllerExtension::Errors protected def access_denied - respond_to_error :not_authorized, :forbidden, home_url + render_error :not_authorized, :forbidden, home_url end + alias_method :render_access_denied, :access_denied def login_required # Warden will intercept the 401 response and call # SessionController#unauthenticated instead. - respond_to_error :not_authorized_login, :unauthorized, login_url + render_error :not_authorized_login, :unauthorized, login_url end + alias_method :render_login_required, :login_required - def not_found - respond_to_error :not_found, :not_found, home_url + def not_found(msg=nil, url=nil) + render_error(msg || :not_found, :not_found, url || home_url) end + alias_method :render_not_found, :not_found + private - def respond_to_error(message, status=nil, redirect=nil) + def render_error(message, status=nil, redirect=nil) error = message message = t(message) if message.is_a?(Symbol) respond_to do |format| |