SpinaCMS / Spina

Spina CMS
http://www.spinacms.com
Other
2.2k stars 408 forks source link

Spina does not raise ActiveRecord::RecordNotFound and renders a static file outside Spina #1377

Closed HatsuMora closed 4 months ago

HatsuMora commented 5 months ago

Hi,

I am trying to use a controller to handle all errors 4xx and 5xx, so I can do a bit more than just sending the 404.html page, and I need Spina to raise ActiveRecord::RecordNotFound if the page is not found.

I noticed the exception is catch and it renders directly the 404.html file without option to modify this behavior, would you be open to accept a PR that changes this behavior based on a config flag? (or change it to always raise)

# Spina::Frontent
    def render_404
      render file: "#{Rails.root}/public/404.html", status: 404, layout: false
    end