Simple Static Pages in Rails
For when you want to have some static-ish pages rendered with minimal configuration within the Rails stack, with sensible defaults including caching, asset pipeline, and nice URLs.
Requirements
Rails 4
Installation
Packaged as a gem, so the usual bundler procedure applies
$ cd your_repo_root/repo_name
$ gem 'has_pages', git: "https://github.com/beautifulcode/has_pages.git
$ bundle
Example Use
You have a set of semi static pages that should be served if no other routes are matched.
For example, given the following request /about/company
, this will look in app/views/pages/about/company
The page will be rendered in the application layout by default, but will use an about
layout if it exists.
This also provides page caching by default of these pages so Rails doesn't get involved on further requests to the same path.
Eventually, a macro of has_pages(options) can be called from your application controller to customize the behaviour of the plugin.
Some macro options could include:
- Caching On/Off
- Cache Directory
- Alternate Layout(s)
- Path Prefix
Copyright (c) 2015 Aaron Glenn, released under the MIT license