Active Record Model From Legacy query

I have a situation where I have some legacy tables that have what I
will call conditional relations. One table is a log and has actions
and action_notes columns if the action is a certain number(value) the
the contents of the action_notes will be a foreign key to another
table but then it can actually be a note for other actions… Hope
that makes sense. So whats the best rails approach?

On Oct 18, 8:55pm, Dale A. [email protected] wrote:

I have a situation where I have some legacy tables that have what I
will call conditional relations. One table is a log and has actions
and action_notes columns if the action is a certain number(value) the
the contents of the action_notes will be a foreign key to another
table but then it can actually be a note for other actions… Hope
that makes sense. So whats the best rails approach?

Unless those log tables are still being written to, I’d typically just
write a migration to actually sort out the mess into a more standard
layout and then work from there.

Oh, and LART the daylights outta whoever thought that design was a
good idea. :wink:

–Matt J.