WordPress lumps posts and static pages together in one database table, but they need to be handled quite differently.
At least for the time being, I’m leaving them in the same table.
First, in the Post model, a different permalink is needed for static pages and for posts:
Then, also in the Post model, I have several scopes:
Then two different methods to find posts, depending on whether the user is logged in or not (see below):
Then, in PostController, the show method becomes a bit more advanced (or messy):
The not_found method is in ApplicationController (see here):
routes.rb needs to be changed, to route (say) .../about to the appropriate page, with the following line going after all the other routing information (but before the root statement):
And there are some changes to the post view, to hide details that are not relevant to static pages (such as date and comments).