Haha it is actually a little bit strange to disclose the details of the models here, especially the same site's own models XD"
Currently we have 3 different models for "articles": Post, Page and Entry (entry is inside portfolio).
However, (intentionally) these 3 models shares 99.99% (ok, actually not mathematically calculated) the same attributes and behaviours:
- translatable title and content
- URL slugging (with friendly_id gem)
- published_at handling in admin panel
- preview in frontend
- tags, comments, sharing
and even the frontend interface for these 3 things are extremely similar.
Actually I do intentionally to make them the same. It is because I do feel they should be the same. And now I'm right.
And even worse (or better??), I now am adding two more models: board games and coupons. And I found they could have the completely the same things too.
So...is it worth to group them together?
Now board games and coupons are subclasses of CollectionItem, which have the same attributes as post and page.
However, Coupon have more attributes than that, e.g. expired_at. So There is a CouponInfo model having 1-to-1 relationship to Coupon model.
It's actually good for me. And so now I can do something I wanted to do:
Currently this great responsive theme is not designed by me (you may fork the originally version in here, which was designed for Octopress).
The theme is great. However I do want a self-designed theme for my own blog.
Now I think it is the time ;)
I would do these 3 steps to do so:
- existing data migration
- remember the translated versions
- entry has an extra homepage attribute (that means there should be an EntryInfo model)
- delete old tables (backing up the database is a common sense)
- change the existing model to subclass from collection item
- run test cases again to confirm working