remove respond_to in favor of an implementation that returns options
This commit is contained in:
parent
d5514bf916
commit
04e47687b2
|
@ -147,12 +147,16 @@ MESSAGE
|
|||
flash[key] = message if message.present?
|
||||
end
|
||||
|
||||
def devise_i18n_options(options)
|
||||
options
|
||||
end
|
||||
|
||||
# Get message for given
|
||||
def find_message(kind, options = {})
|
||||
options[:scope] = "devise.#{controller_name}"
|
||||
options[:default] = Array(options[:default]).unshift(kind.to_sym)
|
||||
options[:resource_name] = resource_name
|
||||
options = devise_i18n_options(options) if respond_to?(:devise_i18n_options, true)
|
||||
options = devise_i18n_options(options)
|
||||
I18n.t("#{options[:resource_name]}.#{kind}", options)
|
||||
end
|
||||
|
||||
|
|
|
@ -64,6 +64,10 @@ module Devise
|
|||
|
||||
protected
|
||||
|
||||
def i18n_options(options)
|
||||
options
|
||||
end
|
||||
|
||||
def i18n_message(default = nil)
|
||||
message = warden_message || default || :unauthenticated
|
||||
|
||||
|
@ -72,7 +76,7 @@ module Devise
|
|||
options[:resource_name] = scope
|
||||
options[:scope] = "devise.failure"
|
||||
options[:default] = [message]
|
||||
options = i18n_options(options) if respond_to?(:i18n_options, true)
|
||||
options = i18n_options(options)
|
||||
|
||||
I18n.t(:"#{scope}.#{message}", options)
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue