mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Call human_attribute_name with a string instead of a symbole
This commit is contained in:
parent
0b54641878
commit
8d2f3179e6
2 changed files with 2 additions and 2 deletions
|
@ -413,7 +413,7 @@ module ActiveModel
|
|||
defaults << "%{attribute} %{message}"
|
||||
|
||||
attr_name = attribute.tr(".", "_").humanize
|
||||
attr_name = @base.class.human_attribute_name(attribute.to_sym, default: attr_name)
|
||||
attr_name = @base.class.human_attribute_name(attribute, default: attr_name)
|
||||
|
||||
I18n.t(defaults.shift,
|
||||
default: defaults,
|
||||
|
|
|
@ -35,7 +35,7 @@ class I18nValidationTest < ActiveModel::TestCase
|
|||
|
||||
def test_errors_full_messages_translates_human_attribute_name_for_model_attributes
|
||||
@person.errors.add(:name, "not found")
|
||||
assert_called_with(Person, :human_attribute_name, [:name, default: "Name"], returns: "Person's name") do
|
||||
assert_called_with(Person, :human_attribute_name, ["name", default: "Name"], returns: "Person's name") do
|
||||
assert_equal ["Person's name not found"], @person.errors.full_messages
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue