I’m working on a portfolio section for my personal website. Each portfolio item, of which there are many, looks about like this:
<li>
<h3>Core Product</h3>
<ul>
<li>Snip</li>
<li>2011 to 2012</li>
</ul>
<%= link_to "http://sniphq.com/demo" %>
<p>
Snip is a company I started in January 2011.
I did all the programming, design, usability testing, sales, marketing—everything.
The overall idea is to allow hairstylists to spend more time on hair and less time on everything else.
</p>
</li>
I don’t like how the data here is so tightly coupled with how the data is displayed. I would be neat if I could do something like this:
snip:
client_name: Snip
project_name: Core Product
period: 2011 to 2012
link: http://sniphq.com/demo
description: Snip is a company I...
And then in my view I could just iterate through these items. I realize I could create a database table for portfolio items, but that would be harder for me as a content writer to maintain, and also more complicated as a programmer than I need it to be.
What would be the best/simplest way to implement this kind of functionality?
There is a gem called StaticModel that you can define your data in a YAML file, and it will have certain attributes of an ActiveRecord::Base class. Check it out here: http://code.quirkey.com/static_model/