
Changing a polymorphic_type in Rails - Shopify
2/18/2022
Introduced a technique to change how Rails persists polymorphic associations by replacing class names with arbitrary strings. This involves overriding the `polymorphic_name` method and using `.unscope` on associations to support both old and new storage formats during a transition period, followed by a database cleanup task. This reduces coupling between the codebase and the database, facilitating future refactoring of class names and namespaces.