explanation of polymorphic in rails

Does someone know rails polymorphic very well and can explain me how I can do something similar than polymorphic and change dynamically the table name for a polymorphic attribute.

I know already that normally you need a have a “_type” attribute to define the table name, but I would like to define my own way to retrieve to table name. I was trying with table_name=“xxx” but it doesn’t works


The foo_type column references a class name, not a table name. I am not aware of any alternative mechanism for controlling by how polymorphic associations are loaded (perhaps a concrete example might clarify things)