From 9feb298c28868ff82cc4e04bc936184a15efb380 Mon Sep 17 00:00:00 2001 From: Nathan Woodhull Date: Sat, 13 Jan 2024 19:24:39 -0500 Subject: [PATCH] Allow the state_machine method to return nil. --- lib/statesman/adapters/active_record_queries.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/statesman/adapters/active_record_queries.rb b/lib/statesman/adapters/active_record_queries.rb index 6f486457..f8f37922 100644 --- a/lib/statesman/adapters/active_record_queries.rb +++ b/lib/statesman/adapters/active_record_queries.rb @@ -53,7 +53,7 @@ def included(base) define_method(:reload) do |*a| instance = super(*a) if instance.respond_to?(:state_machine, true) - instance.send(:state_machine).reset + instance.send(:state_machine)&.reset end instance end