Sha256: 9f522413df7b8d03ffb1a56948a5085ebd08999494a30d6e8fb264600ab6c610

Contents?: true

Size: 799 Bytes

Versions: 17

Compression:

Stored size: 799 Bytes

Contents

class ComplexActiveRecordExample < ActiveRecord::Base
  include AASM

  aasm :left, :column => 'left' do
    state :one, :initial => true
    state :two
    state :three

    event :increment do
      transitions :from => :one, :to => :two, guard: :allowed?
      transitions :from => :two, :to => :three
    end
    event :reset do
      transitions :from => :three, :to => :one
    end
  end

  def allowed?
    true
  end

  aasm :right, :column => 'right' do
    state :alpha, :initial => true
    state :beta
    state :gamma

    event :level_up do
      transitions :from => :alpha, :to => :beta
      transitions :from => :beta, :to => :gamma
    end
    event :level_down do
      transitions :from => :gamma, :to => :beta
      transitions :from => :beta, :to => :alpha
    end
  end

end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
aasm-5.3.1 spec/models/active_record/complex_active_record_example.rb
aasm-5.3.0 spec/models/active_record/complex_active_record_example.rb
aasm-5.2.0 spec/models/active_record/complex_active_record_example.rb
aasm-5.1.1 spec/models/active_record/complex_active_record_example.rb
aasm-5.1.0 spec/models/active_record/complex_active_record_example.rb
aasm-5.0.8 spec/models/active_record/complex_active_record_example.rb
aasm-5.0.7 spec/models/active_record/complex_active_record_example.rb
aasm-5.0.6 spec/models/active_record/complex_active_record_example.rb
aasm-5.0.5 spec/models/active_record/complex_active_record_example.rb
aasm-5.0.4 spec/models/active_record/complex_active_record_example.rb
aasm-5.0.3 spec/models/active_record/complex_active_record_example.rb
aasm-5.0.2 spec/models/active_record/complex_active_record_example.rb
aasm-5.0.1 spec/models/active_record/complex_active_record_example.rb
aasm-5.0.0 spec/models/active_record/complex_active_record_example.rb
aasm-4.12.3 spec/models/active_record/complex_active_record_example.rb
aasm-4.12.2 spec/models/active_record/complex_active_record_example.rb
aasm-4.12.1 spec/models/active_record/complex_active_record_example.rb