Dynamic relation model name based on a field type

Hi all
How I can do a relation with a model based on a field value?
For example I have transaction_type and transaction_list tables,in the transaction_list I have a related_id and in the transaction_type I have a related_model field; Now how I can have a relation with related_modle table with related_id in the transaction_list query?