lib/generators/rambulance/templates/rambulance.rb in rambulance-0.1.2 vs lib/generators/rambulance/templates/rambulance.rb in rambulance-0.2.0
- old
+ new
@@ -1,24 +1,15 @@
Rambulance.setup do |config|
# List of pairs of exception/corresponding http status. In Rails, the default
# mappings are below:
#
- # "ActionController::RoutingError" => :not_found,
- # "AbstractController::ActionNotFound" => :not_found,
- # "ActionController::MethodNotAllowed" => :method_not_allowed,
- # "ActionController::UnknownHttpMethod" => :method_not_allowed,
- # "ActionController::NotImplemented" => :not_implemented,
- # "ActionController::UnknownFormat" => :not_acceptable,
- # "ActionController::InvalidAuthenticityToken" => :unprocessable_entity,
- # "ActionDispatch::ParamsParser::ParseError" => :bad_request,
- # "ActionController::BadRequest" => :bad_request,
- # "ActionController::ParameterMissing" => :bad_request,
- # "ActiveRecord::RecordNotFound" => :not_found,
- # "ActiveRecord::StaleObjectError" => :conflict,
- # "ActiveRecord::RecordInvalid" => :unprocessable_entity,
- # "ActiveRecord::RecordNotSaved" => :unprocessable_entity
+<%=
+ ActionDispatch::ExceptionWrapper.rescue_responses.map do |error_class, status|
+ " # #{error_class.ljust(longest_error_name_size)} => :#{status}"
+ end.join(",\n")
+%>
#
# If you add exceptions in this config, Rambulance uses the pairs you defined
# here *in addition* to the default maddings. You can also override the default
# mappings although you don't have to in most cases.
# If Rambulance receives an exception that is not listed here, it'll render
@@ -29,12 +20,12 @@
# "Pundit::NotAuthorizedError" => :forbidden,
# "YourCustomException" => :not_found
}
# The template name for the layout of the error pages. The default value is
- # 'error'. For exmaple, if this value is set to "error_page", Rambulance uses
+ # 'application'. For exmaple, if this value is set to "error_page", Rambulance uses
# 'app/views/layout/error_page.html.erb' as a layout for all the error pages.
- config.layout_name = "error"
+ config.layout_name = "<%= layout_name %>"
# The directry name to organize error page templates. The default value is
# 'errors'. For exmaple, if this value is set to "error_pages", Rambulance
# uses e.g. 'app/views/error_pages/not_found.html.erb'.
config.view_path = "errors"