Skip to content

allow overriding of model_name in a state schema (useful for i18n lookups) - #21

Open
onyxrev wants to merge 1 commit into
IBM-Cloud:masterfrom
onyxrev:onyxrev/override_model_name
Open

allow overriding of model_name in a state schema (useful for i18n lookups)#21
onyxrev wants to merge 1 commit into
IBM-Cloud:masterfrom
onyxrev:onyxrev/override_model_name

Conversation

@onyxrev

@onyxrev onyxrev commented Jan 14, 2024

Copy link
Copy Markdown
Contributor

This PR introduces the ability to provide a custom model_name in a state schema. This is useful when using i18n.

Example:

schema do
  model_name "User"

  attribute :name, :string
  # ...
end
# en.yml

en:
  activemodel:
    attributes:
      user:
        name: "Username"

In the above example, the human_attribute_name for the schema attribute :name would look up the path activemodel.attributes.user.name and would resolve to Username.

@onyxrev
onyxrev force-pushed the onyxrev/override_model_name branch from 38c6f85 to ca0dffa Compare January 14, 2024 04:50
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.

1 participant