Skip to content

Commit e1786cf

Browse files
Fix support for Rails 7.0
`downcase_first` was introduced in v7.1.
1 parent 2537a30 commit e1786cf

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

lib/devise/failure_app.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,9 @@ def i18n_message(default = nil)
112112
options[:default] = [message]
113113
auth_keys = scope_class.authentication_keys
114114
human_keys = (auth_keys.respond_to?(:keys) ? auth_keys.keys : auth_keys).map { |key|
115-
scope_class.human_attribute_name(key).downcase_first
115+
# TODO: Remove the fallback and just use `downcase_first` once we drop support for Rails 7.0.
116+
human_key = scope_class.human_attribute_name(key)
117+
human_key.respond_to?(:downcase_first) ? human_key.downcase_first : human_key[0].downcase + human_key[1..]
116118
}
117119
options[:authentication_keys] = human_keys.join(I18n.t(:"support.array.words_connector"))
118120
options = i18n_options(options)

0 commit comments

Comments
 (0)