class Jsm::EventExecutor::ActiveModel
Public Instance Methods
can_be_executed?(event, obj)
click to toggle source
check if the obj possible to execute the event
# File lib/jsm/event_executor/active_model.rb, line 3 def can_be_executed?(event, obj) state = event.can_be_transitioning_to(obj) attribute_name = obj.class.state_machine.attribute_name obj.valid? if state validators.validate(state.to, obj) else obj.errors.add(attribute_name, 'no transitions match') end obj.errors.empty? end