foodsoft/app/controllers/errors_controller.rb
2019-10-29 09:41:01 +01:00

31 lines
614 B
Ruby

class ErrorsController < ApplicationController
include Gaffe::Errors
skip_before_action :authenticate
layout :current_layout
def show
render "errors/#{@rescue_response}", formats: :html, status: @status_code
end
private
def select_foodcoop
foodcoop = params[:foodcoop]
if FoodsoftConfig.allowed_foodcoop? foodcoop
FoodsoftConfig.select_foodcoop foodcoop
else
FoodsoftConfig.select_default_foodcoop
end
end
def current_layout
current_user ? 'application' : 'login'
end
def login_layout?
current_user.nil?
end
helper_method :login_layout?
end