Skip to content

Commit

Permalink
Fix NameError (undefined local variable or method current_user_language)
Browse files Browse the repository at this point in the history
  • Loading branch information
ishikawa999 committed Sep 17, 2024
1 parent 83fb4a0 commit f8d6844
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/message_customize/application_controller_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,16 @@ def self.included(base)
module InstanceMethod
def reload_customize_messages
custom_message_setting = CustomMessageSetting.find_or_default
# NOTE: ApplicationController#set_localization sets the appropriate language in I18n.locale
return if custom_message_setting.latest_messages_applied?(I18n.locale)
return if custom_message_setting.latest_messages_applied?(current_user_language)

MessageCustomize::Locale.reload!([I18n.locale])
MessageCustomize::Locale.reload!([current_user_language])
end

private

# NOTE: ApplicationController#set_localization sets the appropriate language in I18n.locale
def current_user_language
I18n.locale
end
end
end
Expand Down

0 comments on commit f8d6844

Please sign in to comment.