Module: StateTransitions
- Defined in:
- lib/state_transitions.rb,
lib/state_transitions/engine.rb,
lib/state_transitions/version.rb,
app/models/state_transitions/application_record.rb
Defined Under Namespace
Modules: ClassMethods
Classes: ApplicationRecord, Current, Engine, StateTransition
Constant Summary
collapse
- VERSION =
"0.1.0"
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.included(base) ⇒ Object
5
6
7
|
# File 'lib/state_transitions.rb', line 5
def self.included(base)
base.extend ClassMethods
end
|
Instance Method Details
#save_state_transition ⇒ Object
61
62
63
64
65
66
67
68
|
# File 'lib/state_transitions.rb', line 61
def save_state_transition
StateTransitions::StateTransition.create!(
resource: self,
state_from: saved_change_to_state.fetch(0),
state_to: saved_change_to_state.fetch(1),
user: StateTransitions::Current.user
)
end
|