Explanation of polymorphic in rails

Hi,
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

thanks

On Monday, December 14, 2015 at 1:43:08 AM UTC, Oto Iashvili wrote:

Hi,
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)

Fred