Patches: Browse | Submit New | Admin

[#13330] versioning legacy data input

Date:
2007-08-24 13:49
Priority:
3
Submitted By:
Nobody
Assigned To:
Nobody (None)
Category:
None
State:
Open
Summary:
versioning legacy data input

Detailed description
When versioning a table that contains records inserted by a legacy application, the version table remains empty. This
is because rails doesn't know about the newly inserted data. To use versioning here, add the code below to the model
you are versioning. As soon as a record is initialized, a version is created if it didn't exist yet.

def after_initialize
  if self.versions.empty?
    self.save_version
  end
end

Add A Comment: Notepad

Please login


Followup

No Followups Have Been Posted

Attached Files:

Name Description Download
No Files Currently Attached

Changes:

No Changes Have Been Made to This Item