Sha256: 967b58cd30fb390e93fa799cc4560c25fc4529a0cc145caa764471f6aecc31e5
Contents?: true
Size: 902 Bytes
Versions: 13
Compression:
Stored size: 902 Bytes
Contents
module Locomotive::Steam module Middlewares # When rendering the page, the developer can stop it at anytime by # raising an PageNotFoundException exception. # Instead of the page, the 404 not found page will be rendered. # # This is particularly helpful with the dynamic routing feature # to avoid duplicated page content (different urls, same HTTP 200 code but same blank page). # class PageNotFound < ThreadSafe include Concerns::Helpers include Concerns::Rendering def _call begin self.next rescue Locomotive::Steam::PageNotFoundException => e # fetch the 404 error page... env['steam.page'] = page_finder.find('404') # ... and render it instead render_page end end private def page_finder services.page_finder end end end end
Version data entries
13 entries across 13 versions & 1 rubygems