Skip to content

Commit

Permalink
Fixes #709
Browse files Browse the repository at this point in the history
Remove memoization to avoid stale localized state name
  • Loading branch information
the-spectator authored and Anil Kumar Maurya committed Oct 15, 2020
1 parent f2b4c38 commit 26a2ab5
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/aasm/core/state.rb
Expand Up @@ -54,8 +54,10 @@ def fire_callbacks(action, record, *args)
end

def display_name
@display_name ||= begin
if Module.const_defined?(:I18n)
@display_name = begin
if @fixed_display_name
@fixed_display_name
elsif Module.const_defined?(:I18n)
localized_name
else
name.to_s.gsub(/_/, ' ').capitalize
Expand All @@ -75,8 +77,8 @@ def for_select
private

def update(options = {})
if options.key?(:display) then
@display_name = options.delete(:display)
if options.key?(:display)
@fixed_display_name = options.delete(:display)
end
@options = options
self
Expand Down

0 comments on commit 26a2ab5

Please sign in to comment.