How to avoid defining state twice in aasm

506 views Asked by At

I'm currently using the aasm gem and it works great. Is it possible to define state just once instead of twice like below?

enum state: [:pending, :active, :inactive]

aasm column: :state, enum: true do
  state :pending, :active, :inactive
  
  event :accept do
    transitions from: :pending, to: :active
  end
  event :pause do
    transitions from: :active, to: :inactive
  end
  event :resume do
    transitions from: :inactive, to: :active
  end
end
0

There are 0 answers