I am using ActiveRecord from BKeeney.com. Love it.
I have inherited a database, so I can’t change the structure. I understand that what I am saying is bad database design, but it is what it is.
I have tableA and tableB.
TableA is a list of pieces of equipment. TableB is a list of Equipment Types, varchar(5).
Normally database design would dictate that you would use the primary key (auto incrementing, integer) as the value you put in TableA, however the person that originally designed this put the actual Equipment Type in TableA.
My problem is that if someone changes the equipment type in TableB, I need to change all the records in TableA for that old equipment type to the new equipment type.
I don’t know if it’s best to put the code in the validate area at the end after all validation is done, but I would have both the old and new value,
or put in the BeforeUpdate, or AfterUpdate or BeforeSave, or AfterSave Events for the class. I’m not sure how to reference the old and new values so I can do the update statement on TableA.
Any help would be appreciated, and documented here in case anyone else has the same question at a future date.
Alan