From ee212acd3045ef37c4110ce07afc7642ab9f472e Mon Sep 17 00:00:00 2001 From: Rahul Ojha Date: Mon, 27 May 2019 10:29:51 +0530 Subject: [PATCH] Fix: _fire method is too long issue --- lib/aasm/core/event.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/aasm/core/event.rb b/lib/aasm/core/event.rb index 2cbd12d..93c18ea 100644 --- a/lib/aasm/core/event.rb +++ b/lib/aasm/core/event.rb @@ -131,13 +131,13 @@ module AASM::Core if to_state == ::AASM::NO_VALUE to_state = nil - elsif to_state.respond_to?(:to_sym) && transitions.map(&:to).flatten.include?(to_state.to_sym) - # nop, to_state is a valid to-state - else + elsif !(to_state.respond_to?(:to_sym) && transitions.map(&:to).flatten.include?(to_state.to_sym)) # to_state is an argument args.unshift(to_state) to_state = nil end + + # nop, to_state is a valid to-state transitions.each do |transition| next if to_state and !Array(transition.to).include?(to_state)