Skip to content

Conversation

Renne1002
Copy link

Resolve #325

This change modifies the enum definition process to correctly resolve the alias_attributed name to the underlying database column.

* This commit modifies enum definitions to correctly handle attributes aliased with `alias_attribute`. Previously, defining an enum on an aliased column would not work. This change ensures seamless functionality with aliased column names.
def self.statuses: () -> ::ActiveSupport::HashWithIndifferentAccess[::String, ::Integer]
def self.alias_roles: () -> ::ActiveSupport::HashWithIndifferentAccess[::String, ::Integer]
Copy link
Author

@Renne1002 Renne1002 Sep 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: Enum with alias_attribute dose not define self.roles , which is expected behavior.

@Renne1002 Renne1002 marked this pull request as ready for review September 2, 2025 04:02
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.

Enum generation does not respect alias_attribute names in enum_class_methods in currently master
1 participant