Static content in your Rails application
Our heros over at thoughtbot.com blogged about static pages and their newly released Rails engine high_voltage. High Voltage helps you dealing with simple, stupid static content pages that nobody wants but everyone needs. ;) (With static pages I’m thinking of imprint, about us, etc.)
In our projects we had a similar solution but to edit the pages more easily and without the need to deploy the whole application we’re saving the content in the database.
Because the database part was missing in high_voltage but I’ve really liked the idea to extract that feature into a rails engine I’ve created a fork last night.
My fork checks if there is a valid template file in views/pages/ – if not it checks the Database and renders the views/pages/show template.
How to use it?
Installation
script/plugin install git://github.com/bumi/high_voltage.git
Create pages
this is up to you. ;)
You can add static files to your app/views/pages/ directory or create a database entry:
HighVoltage::Page.create(:title => "Hello world", :body => "High Voltage! High Voltage!")
That’s it!
For more information check the original thoughtbot post” – You should follow their blog anyway! – And have a look at the readme.
Hope you like my addons.
What are your solutions for static pages?