Skip to content

Configurable polymorphic class name resolution #79

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 19, 2024

Conversation

fusion2004
Copy link
Contributor

@fusion2004 fusion2004 commented Dec 19, 2024

If you are using polymorphic association fields, you can now customize how Subroutine
resolves those class names to a ruby class by setting a global callable/lambda/proc:

::Subroutine.constantize_polymorphic_class_name = ->(class_name) do
  class_name.classify.constantize
end

@fusion2004 fusion2004 force-pushed the configurable-polymorphic-class-resolution branch from b9fa3f9 to 643489b Compare December 19, 2024 02:18
@fusion2004 fusion2004 force-pushed the configurable-polymorphic-class-resolution branch from bfce84e to 860090b Compare December 19, 2024 02:34
@mnelson mnelson merged commit 6240136 into main Dec 19, 2024
4 checks passed
@mnelson mnelson deleted the configurable-polymorphic-class-resolution branch December 19, 2024 02:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants