ActiveRecord bottom half

Perry Smith
2007-07-07T15:57:10Z

I want a different way of doing polymorphic records.  One problem I have
is validates_presence_of does not work for me -- and no one replied to
my question.  I am finding it hard to make sure the database stays
consistent.

What I want to do is create a table that has a unique id and a string
which will be the type.  The other tables that type will point to will
have the same id and the attributes for that type.  So, the first table
may be items and items could reference people, companies, etc.  The key
to people, companies, etc is the same id as for item -- i.e. if you
union all of the sub tables, you will have each id at most one time.

I believe, using PostgreSQL''s features, this will be easier to keep
consistent.  Of course, I may find out that I''m full of BS.

But, part of the knowledge I need to gain is how ActiveRecord goes from
the blob of mess that the database returns to an instance of a
particular class.  If anyone can help me out and tell me where to look,
etc, that would be much appreciated.


Thank you,
Perry Smith
Ease Software, Inc. ( http://www.easesoftware.com )

Low cost SATA Disk Systems for IBMs p5, pSeries, and RS/6000 AIX systems