This repository has been archived on 2020-05-27. You can view files and clone it, but cannot push or open issues/pull-requests.
2007-09-27 01:15:22 -04:00
|
|
|
class ApplicationController < ActionController::Base
|
|
|
|
session :session_key => '_barleysodas_session_id'
|
2007-11-11 01:42:58 -05:00
|
|
|
|
2007-11-17 02:12:50 -05:00
|
|
|
##
|
|
|
|
# Ensures that the request was made using an Ajax request.
|
|
|
|
#
|
|
|
|
def ensure_xhr
|
|
|
|
return false unless request.xhr?
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
2007-11-11 01:42:58 -05:00
|
|
|
##
|
|
|
|
# Sane error and missing document messages.
|
|
|
|
#
|
|
|
|
def rescue_action_in_public(exception)
|
|
|
|
logger.debug("#{exception.class.name}: #{exception.to_s}")
|
|
|
|
exception.backtrace.each { |bt| logger.debug "! #{bt}" }
|
|
|
|
case exception
|
|
|
|
when ::ActiveRecord::RecordNotFound,
|
|
|
|
::ActionController::UnknownController,
|
|
|
|
::ActionController::UnknownAction,
|
|
|
|
::ActionController::RoutingError
|
|
|
|
render :file => File.join(RAILS_ROOT, 'public/404.html'),
|
|
|
|
:status => '404 Not Found'
|
|
|
|
else
|
|
|
|
render :file => File.join(RAILS_ROOT, 'public/500.html'),
|
|
|
|
:status => '500 Error'
|
|
|
|
end
|
|
|
|
end
|
2007-11-11 02:03:38 -05:00
|
|
|
end
|