ID and Archiving in Rails

Hi All,

I have created a table “record_archives” using engine=archive in my
application to archive data for a table “records”. I want to insert
data into archived table at specific time, like once in a week. I have
created model for that table but not used any migration and directly
created a table using script. The script includes default value for id
is ZERO and Initially there is not a single entry in both tables.

When i creates a record using RecordArchive.create(:id=>rec.id, …),
it inserts ZERO into archive table even though i have passed an id
for that record.

And i am not sure why it doesn’t insert the value for id into archived
table?

Please somebody can answer my question, How to insert the value for
id? Is there any other way to insert the actual value of ID? Do i need
to use any other way to insert the data into archived table as Rails
models may be using index and which is not supported in archive
engine?

Thanks,
Manohar.

On 9 Jan 2009, at 13:14, manohar amrutkar wrote:

When i creates a record using RecordArchive.create(:id=>rec.id, …),
The id column is protected from mass assignment. At the very least
you’d have to do something like
foo = Foo.new
foo.id = 123
foo.save!

Fred

Thanks Frederick C. !!!

On Jan 9, 6:49 pm, Frederick C. [email protected]