Advice needed for new versioning plugin


#1

I’m working on a new plugin called acts_as_archived. It is based on
acts_as_versioned, but uses a different table schema and has some other
features. The table design is like so (let’s say we’re dealing with
models called Record):

records
id
archived_record_id

archived_records
id
record_id
name
date
version
etc

The main records table serves as a lookup table for the current
version’s content. All versions of a Record (including the current one)
are stored as separate rows in archived_records.

I have basic find and save working, but I am having some problems with
Record.new. Since the records table only has one field to AR
(archived_record_id), Record.new returns a Record with only that column
as an attribute. I need to have a Place with the correct attributes,
which are really the columns in archived_records. I thought about
overriding initialize to add this functionality, but is there a better
way to do it?

Thanks