This has been bugging me for some time.
The implementation for polymorphic associations in Rails is *still*
using the record_type, record_id model where record type has to be the
entire written out class name.
All of this logic is hardcoded deep in ActiveRecord, making it very
difficult to deviate from this.
For example, what if I wanted to have the "type" column be a tinyint
unsigned that mapped with the name of the class in some hash? Or what if
I wanted to infer the type from a different column all together?
Repeating a long classname for every row in a database is repetitive and
can eat up database size. For example, "SomeLongModuleName::ModelName"
could be replaced with "1", which would then map to that name. That
would be 1 byte for the TinyInt(3) implementation vs N bytes for
actually spelling out the class name *every* time.
Whats frustrating me is the inability to easily configure this, or even
to patch this to get it to work properly. Is anyone also having issues
with this or is there anything out there to give you more control over