diff --git a/gems/activemodel/6.0/activemodel-generated.rbs b/gems/activemodel/6.0/activemodel-generated.rbs index 510cb569b..63c2590a1 100644 --- a/gems/activemodel/6.0/activemodel-generated.rbs +++ b/gems/activemodel/6.0/activemodel-generated.rbs @@ -2381,13 +2381,6 @@ module ActiveModel # ActiveModel::Translation#human_attribute_name. def lookup_ancestors: () -> untyped - # Transforms attribute names into a more human format, such as "First name" - # instead of "first_name". - # - # Person.human_attribute_name("first_name") # => "First name" - # - # Specify +options+ with additional translating options. - def human_attribute_name: (untyped attribute, ?::Hash[untyped, untyped] options) -> untyped end end diff --git a/gems/activemodel/6.0/activemodel.rbs b/gems/activemodel/6.0/activemodel.rbs index 0c5f356a5..3facb8a5f 100644 --- a/gems/activemodel/6.0/activemodel.rbs +++ b/gems/activemodel/6.0/activemodel.rbs @@ -505,3 +505,9 @@ module ActiveModel end end end + +module ActiveModel + module Translation + def human_attribute_name: (String | Symbol attribute, ?::Hash[Symbol, untyped] options) -> String + end +end diff --git a/gems/activemodel/7.1/_test/test.rb b/gems/activemodel/7.1/_test/test.rb index 1f7d248cd..12d4200c2 100644 --- a/gems/activemodel/7.1/_test/test.rb +++ b/gems/activemodel/7.1/_test/test.rb @@ -23,3 +23,7 @@ class Person error.full_message error.match?(:name) error.strict_match?(:name, :too_short, count: 5) + +Person.human_attribute_name("name") +Person.human_attribute_name(:name) +Person.human_attribute_name("name", default: "Name") diff --git a/gems/activemodel/7.1/_test/test.rbs b/gems/activemodel/7.1/_test/test.rbs index 8774d21f2..4783de2ac 100644 --- a/gems/activemodel/7.1/_test/test.rbs +++ b/gems/activemodel/7.1/_test/test.rbs @@ -5,6 +5,7 @@ class Person extend ActiveModel::AttributeRegistration::ClassMethods include ActiveModel::Validations extend ActiveModel::Validations::ClassMethods + extend ActiveModel::Translation attr_accessor name: String? end diff --git a/gems/activemodel/7.1/activemodel-generated.rbs b/gems/activemodel/7.1/activemodel-generated.rbs index c8381ef30..a2066fd39 100644 --- a/gems/activemodel/7.1/activemodel-generated.rbs +++ b/gems/activemodel/7.1/activemodel-generated.rbs @@ -2380,14 +2380,6 @@ module ActiveModel # ActiveModel::Errors#full_messages and # ActiveModel::Translation#human_attribute_name. def lookup_ancestors: () -> untyped - - # Transforms attribute names into a more human format, such as "First name" - # instead of "first_name". - # - # Person.human_attribute_name("first_name") # => "First name" - # - # Specify +options+ with additional translating options. - def human_attribute_name: (untyped attribute, ?::Hash[untyped, untyped] options) -> untyped end end diff --git a/gems/activemodel/7.1/activemodel.rbs b/gems/activemodel/7.1/activemodel.rbs index 0c5f356a5..3facb8a5f 100644 --- a/gems/activemodel/7.1/activemodel.rbs +++ b/gems/activemodel/7.1/activemodel.rbs @@ -505,3 +505,9 @@ module ActiveModel end end end + +module ActiveModel + module Translation + def human_attribute_name: (String | Symbol attribute, ?::Hash[Symbol, untyped] options) -> String + end +end