Skip to content

Pass base object to human_attribute_name for labels#1812

Merged
nashby merged 1 commit intoheartcombo:mainfrom
motine:pass-base-to-i18n
Jun 25, 2024
Merged

Pass base object to human_attribute_name for labels#1812
nashby merged 1 commit intoheartcombo:mainfrom
motine:pass-base-to-i18n

Conversation

@motine
Copy link
Copy Markdown
Contributor

@motine motine commented Mar 1, 2023

When discovering translations, Rails passes the base object to human_attribute_name. This is helpful because human_attribute_name is a class method and does not have access to instance methods. If someone wants to customize the behavior of said method based on properties of the instance, this is not possible without this argument. This merge request makes a tiny change to pass this base object.

@nashby nashby merged commit b8abb1b into heartcombo:main Jun 25, 2024
@nashby
Copy link
Copy Markdown
Collaborator

nashby commented Jun 25, 2024

@motine thanks, that's useful indeed!

nashby added a commit that referenced this pull request Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants