lib/rambulance/exceptions_app.rb in rambulance-3.1.0 vs lib/rambulance/exceptions_app.rb in rambulance-3.2.0

- old
+ new

@@ -36,11 +36,15 @@ env["PATH_INFO"][1..-1].to_sym.tap do |_status_in_words| env["PATH_INFO"] = "/#{Rack::Utils::SYMBOL_TO_STATUS_CODE[_status_in_words]}" end end - action(status_in_words).call(env) + if exception.nil? && status_in_words == :unprocessable_entity + [302, { "Location" => "/rambulance/unprocessable_content" }, [""]] + else + action(status_in_words).call(env) + end end def self.local_prefixes [Rambulance.view_path] end @@ -49,9 +53,15 @@ eval <<-ACTION, nil, __FILE__, __LINE__ + 1 def #{status_in_words} render(template_exists?(error_path) ? error_path : error_path(:internal_server_error)) end ACTION + end + + def unprocessable_entity + unprocessable_content_path = error_path(:unprocessable_content) + + render(template_exists?(unprocessable_content_path) ? unprocessable_content_path : error_path(:internal_server_error)) end def process(action, *args) if action.to_s.empty? action = request.env["PATH_INFO"][1..-1].to_sym