app/controllers/concerns/error_renderer.rb
# This method is used in controllers to catch errors and render error page.
# It differentiates between html, modal, js and polling errors.
# Request vom Polling service which end up in error will display Flash-Errors.
# GET-Requests for modal content will show errors inside modal window.
# JS-POST requests (e.g.: remote: true) will display error dialog.
This method is used in controllers to catch errors and render error page.
It differentiates between html, modal, js and polling errors.
Request vom Polling service which end up in error will display Flash-Errors.
GET-Requests for modal content will show errors inside modal window.
JS-POST requests  will display error dialog.
This method is used in controllers to catch errors and render error page . It differentiates between html modal js and polling errors . Request vom Polling service which end up in error will display Flash - Errors . GET - Requests for modal content will show errors inside modal window . JS - POST requests will display error dialog .
def rescue_and_render_exception_page(*exception_classes)
      exception_classes = exception_classes.first if exception_classes.first.is_a?(Array)
      exception_mapping = {}
      klasses = []
      exception_classes.each do |exception_class|
        if exception_class.is_a?(Hash)
          exception_mapping[exception_class.keys.first.to_s] = exception_class.values.first
          klasses << exception_class.keys.first.to_s
        else
          klasses << exception_class
        end
      end
      rescue_from *klasses do |exception|
        map = exception_mapping[exception.class.name]
        unless map
          klass = nil
          exception_mapping.each do |class_name, mapping|
            found_class = eval(class_name)
            next if klass && found_class > klass
            map = mapping if found_class > exception.class
          end
          map ||= {}
        end
        render_exception_page(exception, map)
      end
    end
def rescue_and_render_exception_page ( * exception_classes ) exception_classes = exception_classes . first if exception_classes . first . is_a? ( Array ) exception_mapping = { } klasses = [ ] exception_classes . each do | exception_class | if exception_class . is_a? ( Hash ) exception_mapping [ exception_class . keys . first . to_s ] = exception_class . values . first klasses << exception_class . keys . first . to_s else klasses << exception_class end end rescue_from * klasses do | exception | map = exception_mapping [ exception . class . name ] unless map klass = nil exception_mapping . each do | class_name , mapping | found_class = eval ( class_name ) next if klass && found_class > klass map = mapping if found_class > exception . class end map ||= { } end render_exception_page ( exception , map ) end end
This method is used in controllers to catch errors and render error page.
This method is used in controllers to catch errors and render error page .
exception_classes
<not_specific>