Add ActiveModel::Translation human_attribute_name type#1007
Open
babashunya wants to merge 1 commit intoruby:mainfrom
Open
Add ActiveModel::Translation human_attribute_name type#1007babashunya wants to merge 1 commit intoruby:mainfrom
babashunya wants to merge 1 commit intoruby:mainfrom
Conversation
32f8129 to
4e3d760
Compare
## Overview The `human_attribute_name` method in `ActiveModel::Translation` had `untyped` for both arguments and return value. Since the implementation always returns `String` (either from `I18n.translate` or `.humanize` fallback), and the first argument accepts `String` or `Symbol` (`.to_s` is called internally), the type has been updated to be more specific. ## References - human_attribute_name - https://api.rubyonrails.org/classes/ActiveModel/Translation.html#method-i-human_attribute_name - https://github.com/rails/rails/blob/main/activemodel/lib/active_model/translation.rb
4e3d760 to
155ec9f
Compare
|
@babashunya Thanks for your contribution! Please follow the instructions below for each change. Available commandsYou can use the following commands by commenting on this PR.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Overview
The
human_attribute_namemethod inActiveModel::Translationhaduntypedfor both arguments and return value.Since the implementation always returns
String(either fromI18n.translateor.humanizefallback), and the first argument acceptsStringorSymbol(.to_sis called internally), the type has been updated to be more specific.References