Forum: Ruby on Rails Advice needed for new versioning plugin

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.
Jim B. (Guest)
on 2006-04-05 12:48
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
This topic is locked and can not be replied to.