Custom content widget design


#1

Hello all,

I am trying to design a reusable widget content system, where I can
easily lay
out a bundle of widgets on a page and allow a user with proper
administrative
rights to click and change them.

For the database storage, I don’t want to have to create a new table for
every
different classification of widget (ie, list, text body, image, etc). I
would like to create a central repository for all data in the content
table,
serializing the widgets data to YAML for storage and retrieval in a
database
text field.

My model looks like so:
class Content < ActiveRecord::Base
serialize :content
end

and my table :
DROP TABLE IF EXISTS contents;
CREATE TABLE contents (
content_id bigint(1) NOT NULL auto_increment,
tag char(25) default NULL,
user_id char(50) default NULL,
content longtext,
PRIMARY KEY (content_id)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

What would be the correct way to validate data in this situation?

Opinions/insight will be greatly appreciated
thank you
Tim