BlogApp, Day Two
Published 2017-08-31 by wbhauck in

The BlogApp is coming along. I'm building it so that some of the generic pages (like About) are served from the blog itself. Normally, I'd build a page controller that pointed to a hard-coded page that had to be updated with an application deployment and restart. By using a customized route I can create the content in the blog itself. That means I can update the content on the fly.

This is the customized route I created:
get '/about', to: 'posts#show', blog_id: 1, id: 1

There is an issue (or two) with this approach. I have to use a specific blog and post for the About page entry. Otherwise a standard blog post will get served up. I'm also limited to displaying an About page that has the exact same formatting as a standard blog post. Yes, I could simply have an About controller with a simple model consisting of title:string, body:text. It would serve the same functionality. I'd still have to use a custom route so the About page had a URL of "/about" instead of "/abouts/1". The current way works so I'll stick with it for now. If it presents an issue in the future I'll add it to the BlogApp Product on Project Useful.

Tagged: BlogApp, Personal Project, Ruby on Rails