Closed mehmetaydogduu closed 6 months ago
If anyone wants to access shipped?, purchased? like methods from model directly. I have a solution.
Store current state on the model. Define an enum like this. enum state: PaymentTransactionStateMachine.states.collect { |s| [s,s]}.to_h
Useful when you need checks like if @transaction.success?
This is more fast and short way because it doesn't query anything if you already have your model in memory.
If anyone wants to access shipped?, purchased? like methods from model directly. I have a solution.
Store current state on the model. Define an enum like this. enum state: PaymentTransactionStateMachine.states.collect { |s| [s,s]}.to_h
Useful when you need checks like if @transaction.success?
This is more fast and short way because it doesn't query anything if you already have your model in memory.