module Ecom module Core class LookaheadPlanReviewTime < ApplicationRecord include AASM belongs_to :lookahead_plan validates :lookahead_plan_id, :lookahead_plan, :lookahead_plan_revision_number, :review_time, :status, presence: true validates_numericality_of :lookahead_plan_revision_number, greater_than_or_equal_to: 0 aasm column: 'status' do state :awaiting, initial: true state :attended state :cancelled event :attend do transitions from: :awaiting, to: :attended, guard: -> { status == 'awaiting' } end event :cancel do transitions from: :awaiting, to: :cancelled, guard: -> { status == 'awaiting' } end end end end end