Forum: Ruby on Rails custom content widget design

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
3c426754bbc5f54a87ee8332b3e69b98?d=identicon&s=25 Tim Harper (Guest)
on 2006-04-19 01:10
(Received via mailing list)
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
This topic is locked and can not be replied to.