diff --git a/CHANGELOG.md b/CHANGELOG.md index c5a224a3..c8d38aa9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ * Raise InvalidContext error when the current state does not define a state-driven behavior * Fix target state being indeterminate for transitions that use blacklists * Allow super to be called within state-driven behaviors +* Fix issue with Rails 6.1+ where ActiveRecord.column_defaults returns `frozen` hash ## 1.2.0 / 2013-03-30 diff --git a/lib/state_machine/machine.rb b/lib/state_machine/machine.rb index 6aa6eae0..d9ed69b2 100644 --- a/lib/state_machine/machine.rb +++ b/lib/state_machine/machine.rb @@ -701,7 +701,7 @@ def initialize_state(object, options = {}) if state && (options[:force] || initialize_state?(object)) value = state.value - if hash = options[:to] + if hash = options[:to].dup hash[attribute.to_s] = value else write(object, :state, value)