foodsoft/app/controllers/errors_controller.rb
Patrick Gansterer 52dc7b1387 Raise a RoutingError for unknown foodcoop in multi_coop_installs
This gives the correct error code for request to files in the root
folder (e.g. /apple-touch-icon.png), which do not exist.
2017-09-25 10:16:03 +02:00

31 lines
598 B
Ruby

class ErrorsController < ApplicationController
include Gaffe::Errors
skip_before_filter :authenticate
layout :current_layout
def show
render "errors/#{@rescue_response}", 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