Content Blocks aims to be a tiny set of reusable AR models for site fragments. Currently it consists of only one model: Snippet. The following usage example will tell you more.
As a gem in your Gemfile:
ContentBlocks::Snippet.create :label => :label_for_snippet, :content => 'h2. Title' ContentBlocks::Snippet[:label_for_snippet].publish!
<%= ContentBlocks::Snippet[:label_for_snippet].content %>
Then it will render textilized content column from Snippet model:
I you'd rather like to access content without textilization, use:
<%= ContentBlocks::Snippet[:label_for_snippet].raw_content %>
You can have multiple snippets with the same label, only one can be published at the same time though. Snippets are also automatically created on first access if they don't exist.
Copyright © 2010 Paweł Pacana. Released under MIT license.