integral
integral copied to clipboard
BUG: Deleting all pages causes error when viewing front end
Environment
- Ruby 2.4.1
- Rails 5.2.1
- Integral v1.0.1
Description of issue
Deleting all pages causes the front end to break.
Current behaviour
Error Couldn't find Integral::Page with 'id'=1 [WHERE
integral_pages.
deleted_at IS NULL]
is thrown when all the pages are deleted and a user tries to navigate to the front end.
Expected behaviour
- Option A. For the user to be blocked from deleting all pages.
- Option B. Have a demo page that only becomes present when there are no pages available, or friendly error page for non logged in users saying there is no content and another page for logged in users/admins to create their first page.
I'd go with option A.
Before Integral allows the user to delete a page it should first check if that page is the homepage. If it is return error message.