SpinaCMS / Spina

Spina CMS
http://www.spinacms.com
Other
2.18k stars 399 forks source link

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

Closed HatsuMora closed 1 week ago

HatsuMora commented 1 month 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