Method: Devise::FailureApp#i18n_message

Defined in:
lib/devise/failure_app.rb

#i18n_message(default = nil) ⇒ Object (protected)



105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/devise/failure_app.rb', line 105

def i18n_message(default = nil)
  message = warden_message || default || :unauthenticated

  if message.is_a?(Symbol)
    options = {}
    options[:resource_name] = scope
    options[:scope] = "devise.failure"
    options[:default] = [message]
    auth_keys = scope_class.authentication_keys
    keys = (auth_keys.respond_to?(:keys) ? auth_keys.keys : auth_keys).map { |key| scope_class.human_attribute_name(key) }
    options[:authentication_keys] = keys.join(I18n.t(:"support.array.words_connector"))
    options = i18n_options(options)

    I18n.t(:"#{scope}.#{message}", **options)
  else
    message.to_s
  end
end