Skip to content

Commit

Permalink
resolve state-machines#34, prefer hard coded state human_name over de…
Browse files Browse the repository at this point in the history
…fault translation
  • Loading branch information
vanboom committed Jul 31, 2024
1 parent 3ae1274 commit dab8194
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/state_machines/integrations/active_model.rb
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ module Integrations #:nodoc:
#
# In order to hook in observer support for your application, the
# ActiveModel::Observing feature must be included. This can be added by including the
# https://github.com/state-machines/state_machines-activemodel-observers gem in your
# https://github.com/state-machines/state_machines-activemodel-observers gem in your
# Gemfile. Because of the way
# ActiveModel observers are designed, there is less flexibility around the
# specific transitions that can be hooked in. However, a large number of
Expand Down Expand Up @@ -504,7 +504,7 @@ def add_callback(type, options, &block)
# Configures new states with the built-in humanize scheme
def add_states(*)
super.each do |new_state|
new_state.human_name = ->(state, klass) { translate(klass, :state, state.name) }
new_state.human_name ||= ->(state, klass) { translate(klass, :state, state.name) }
end
end

Expand Down

0 comments on commit dab8194

Please sign in to comment.