Sha256: e4d5d13475b998c7a8ab00177aa81eb27dfddfe52122063f5b43bc00d8a6a705

Contents?: true

Size: 827 Bytes

Versions: 26

Compression:

Stored size: 827 Bytes

Contents

class WithEnumWithoutColumn < ActiveRecord::Base
  include AASM

  if ActiveRecord::VERSION::MAJOR >= 4 && ActiveRecord::VERSION::MINOR >= 1 # won't work with Rails <= 4.1
    enum status: {
      opened: 0,
      closed: 1
    }
  end

  aasm :column => :status do
    state :closed, initial: true
    state :opened

    event :view do
      transitions :to => :opened, :from => :closed
    end
  end
end

class MultipleWithEnumWithoutColumn < ActiveRecord::Base
  include AASM
  if ActiveRecord::VERSION::MAJOR >= 4 && ActiveRecord::VERSION::MINOR >= 1 # won't work with Rails <= 4.1
    enum status: {
      opened: 0,
      closed: 1
    }
  end

  aasm :left, :column => :status do
    state :closed, initial: true
    state :opened

    event :view do
      transitions :to => :opened, :from => :closed
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

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