Building blocks for a CMS
Though there’s been a few attempts at creating high-level, pluggable components in Rails, nothing has really seemed to catch on. There’s Rails engines and some full-blown CMS packages, but there’s still a tendency to built things from the ground up. Why is this?
I’ll list a few low-level tools that you can integrate into any project, that don’t mess with Rails internals and are dead-easy to set up and use.
acts_as_tree or acts_as_nested_set
Store previous copies of Pages, Assets or any danged model that you please.
Building on top of acts_as_versioned, this provides versioning support for your associations, so if you had a
Pagethat had associated
ImageAssetsyou could retrieve an exact copy of your page along with the associated image assets at that point in time.
Built into Rails 1.1, polymorphic associations allow you to associate a model with any other type of model through a polymorphic join association. This means you could tack a Comment onto any of your model objects, like in the following example:
class Comment < ActiveRecord::Base belongs_to :commentable, :polymorphic => true end
Adding comment support to a model is simply a matter of inserting a
class Post < ActiveRecord::Base has_many :comments, :as => :commentable end
Provides both file and DB-based upload storage, as well has ImageMagick support for auto-resizing of images. If this isn’t flexible enough there’s the more image-manipulation-based ImageMagick for Rails plugin.
What other building blocks have you used when adding typically CMS-like features to your Rails application?