Method: Mango::Application.not_found
- Defined in:
- lib/mango/application.rb
.not_found ⇒ Object
Renders a 404 page with a 404 HTTP response code.
First, the application attempts to render a public 404 file stored in settings.public_dir
. If
a public 404 file is found, the application will:
- Send the public 404 file with a 404 HTTP response code
- Halt execution
For example:
`-- themes
`-- default
`-- public
`-- 404.html
GET /page_not_found => 404 themes/default/public/404.html
If no match is found, the application attempts to render a 404 template stored in
settings.views
. If a 404 template is found, the application will not render it within a
layout template, even if an appropriately named layout template exists within
settings.views
. If a 404 template is found, the application will:
- Render the 404 template, without a layout template, as HTML
- Send the rendered 404 template with a 404 HTTP response code
- Halt execution
For example:
|-- content
| `-- index.haml
`-- themes
`-- default
`-- views
`-- 404.haml
GET /page_not_found => 404 themes/default/views/404.haml
Finally, if no matches are found, the application sends a basic "Page Not Found" page with a 404 HTTP response code.
264 265 266 267 268 269 |
# File 'lib/mango/application.rb', line 264 not_found do file_name = "404" render_404_public_file! file_name render_404_template! file_name "<!DOCTYPE html><title>404 Page Not Found</title><h1>404 Page Not Found</h1>" end |