app/models/concerns/state_transition_support.rb
# Triggers an event, moving record to associated state, if permitted
# Returns false if event not permitted
Triggers an event, moving record to associated state, if permitted
Returns false if event not permitted
Triggers an event moving record to associated state if permitted Returns false if event not permitted
def trigger(event, metadata={})
      if (event_permitted(event) || User.is_admin?(metadata[:user_id])) &&
          required_metadata_present?(event, metadata)
        to_state = self.event_to_state(event)
        callback_metadata = metadata.clone
        transition_to(to_state, metadata)
        if respond_to?(:event_callbacks)
          event_callbacks(event, callback_metadata)
          reload
        end
        update_index
        true
      else
        false
      end
    end
def trigger ( event , metadata = { } ) if ( event_permitted ( event ) || User . is_admin? ( metadata [ :user_id ] ) ) && required_metadata_present? ( event , metadata ) to_state = self . event_to_state ( event ) callback_metadata = metadata . clone transition_to ( to_state , metadata ) if respond_to? ( :event_callbacks ) event_callbacks ( event , callback_metadata ) reload end update_index true else false end end
Triggers an event, moving record to associated state, if permitted
Returns false if event not permitted
Triggers an event moving record to associated state if permitted Returns false if event not permitted
event
<not_specific>
metadata
<not_specific>