Rails CMS Bootstrap
This is a fairly bare bones Rails app illustrating how to create the beginnings of a CMS UI using Rails 5, Postgres 9, and Bootstrap 4.
NOTE: I have also put together a Clojure CMS REST API based on Mongodb. For a CMS with versioning a document database seems like a good fit.
- The model hierarchy is: Site -> Page -> Widget. The page/widget relationship is modeled via an array of IDs in a JSON column in Postgres. It is easier to version documents than normalized relational data models.
- There is the beginnings of a simple versioning scheme for the Page model. It saves versions in a PageVersion model.
- The Page model has a publication status and it maintains a unique url (path).
- There is a User model and login/login routes. Authentication is required for all pages.
- There is a change log (audit) for all write operations that are performed by users (editors) of the CMS
- Simplicity is a prerequisite for reliability
- Be restrictive with library dependencies. This helps with simplicity and Rails upgrades.
- Respect Rails and Ruby idioms
bundle install bin/rake db:create db:migrate db:seed bin/rails s open http://localhost:3000
Deploying to Heroku
Create your app on heroku with the Postgres addon and then do:
heroku git:remote -a <my-heroku-app> git push heroku master heroku run rake db:migrate db:seed heroku open