repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/multiple_transitions_that_differ_only_by_guard.rb | spec/models/multiple_transitions_that_differ_only_by_guard.rb | class MultipleTransitionsThatDifferOnlyByGuard
include AASM
attr_accessor :executed_second
aasm do
state :start, :initial => true
state :gone
event :go do
transitions :from => :start, :to => :gone, :guard => :returns_false, :after => :this_should_not_execute
transitions :from => :start,... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/sub_class_with_more_states.rb | spec/models/sub_class_with_more_states.rb | require_relative 'super_class'
class SubClassWithMoreStates < SuperClass
include AASM
aasm do
state :foo
end
end
class SubClassWithMoreStatesMultiple < SuperClassMultiple
include AASM
aasm(:left) do
state :foo
end
aasm(:right) do
state :archived
end
end
| ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/no_initial_state.rb | spec/models/no_initial_state.rb | class NoInitialState
include AASM
aasm do
state :read
state :ended
event :foo do
transitions :to => :ended, :from => [:read]
end
end
end
class NoInitialStateMultiple
include AASM
aasm(:left) do
state :read
state :ended
event :foo do
transitions :to => :ended, :from... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/guardian.rb | spec/models/guardian.rb | class Guardian
include AASM
def inner_guard(options={})
end
aasm do
state :alpha, :initial => true
state :beta
event :use_one_guard_that_succeeds do
transitions :from => :alpha, :to => :beta, :guard => :succeed
end
event :use_one_guard_that_fails do
transitions :from => :alpha... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/state_machine_with_failed_event.rb | spec/models/state_machine_with_failed_event.rb | class StateMachineWithFailedEvent
include AASM
aasm do
state :init, :initial => true
state :failed
state :sent
event :failed do
transitions :from => :init, :to => :failed
end
event :send, :before => :callback do
transitions :from => :init, :to => :sent
end
end
def call... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/this_name_better_not_be_in_use.rb | spec/models/this_name_better_not_be_in_use.rb | class ThisNameBetterNotBeInUse
include AASM
aasm do
state :initial
state :symbol
state :string
state :array
state :proc
end
end
| ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/parametrised_event_multiple.rb | spec/models/parametrised_event_multiple.rb | class ParametrisedEventMultiple
include AASM
aasm(:left) do
state :sleeping, :initial => true
state :showering
state :working
state :dating
state :prettying_up
event :wakeup do
transitions :from => :sleeping, :to => [:showering, :working]
end
event :dress do
transitions... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/guard_arguments_check.rb | spec/models/guard_arguments_check.rb | class GuardArgumentsCheck
include AASM
aasm do
state :new, :reviewed, :finalized
event :mark_as_reviewed,
:guard => proc { |*args| arguments_list(*args) } do
transitions :from => :new, :to => :reviewed
end
end
def arguments_list(arg1, arg2)
return false unless arg1.nil?
tr... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/simple_custom_example.rb | spec/models/simple_custom_example.rb | class CustomAASMBase < AASM::Base
# A custom transition that we want available across many AASM models.
def count_transitions!
klass.class_eval do
aasm :with_klass => CustomAASMBase do
after_all_transitions :increment_transition_count
end
end
end
# A custom annotation that we want a... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/foo.rb | spec/models/foo.rb | module Fooable
def self.included(base)
base.class_eval do
aasm do
state :open, :initial => true, :before_exit => :before_exit
state :closed, :before_enter => :before_enter
state :final
event :close, :success => :success_callback do
transitions :from => [:open], :to... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/sub_classing.rb | spec/models/sub_classing.rb | class SubClassing < Silencer
end | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/silencer.rb | spec/models/silencer.rb | class Silencer
include AASM
# yes, this line is here on purpose
# by this, we test if overriding configuration options works if
# the state machine is "re-opened"
aasm :whiny_transitions => true
aasm :whiny_transitions => false do
state :silent, :initial => true
state :crying
state :smiling
... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/simple_example.rb | spec/models/simple_example.rb | class SimpleExample
include AASM
aasm do
state :initialised, :initial => true
state :filled_out
state :denied
state :authorised
event :fill_out do
transitions :from => :initialised, :to => :filled_out
end
event :deny do
transitions from: :initialised, to: :denied
end
... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/sub_class.rb | spec/models/sub_class.rb | require_relative 'super_class'
class SubClass < SuperClass
# Add an after callback that is not defined in the parent
aasm.state_machine.events[:foo].options[:after] = [:after_foo_event]
# Add global callback that is not defined in the parent
aasm.state_machine.global_callbacks[:after_all_transitions] = :after... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/multi_transitioner.rb | spec/models/multi_transitioner.rb | class MultiTransitioner
include AASM
attr_accessor :can_run
def initialize
@can_run = false
end
aasm do
state :sleeping, :initial => true
state :running
state :dancing
state :dead
event :start do
transitions :from => :sleeping, :to => :running, guard: :runnable?
transit... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/valid_state_name.rb | spec/models/valid_state_name.rb | class ValidStateName
include AASM
aasm do
state :invalid, :initial => true
state :valid
event :valid do
transitions :to => :valid, :from => [:invalid]
end
end
end
class ValidStateNameMultiple
include AASM
aasm(:left) do
state :invalid, :initial => true
state :valid
event :... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/guardian_multiple.rb | spec/models/guardian_multiple.rb | class GuardianMultiple
include AASM
aasm(:left) do
state :alpha, :initial => true
state :beta
event :use_one_guard_that_succeeds do
transitions :from => :alpha, :to => :beta, :guard => :succeed
end
event :use_one_guard_that_fails do
transitions :from => :alpha, :to => :beta, :guard... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/states_on_one_line_example.rb | spec/models/states_on_one_line_example.rb | class StatesOnOneLineExample
include AASM
aasm :one_line do
state :initial, :initial => true
state :first, :second
end
end
| ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/simple_multiple_example.rb | spec/models/simple_multiple_example.rb | class SimpleMultipleExample
include AASM
aasm(:move) do
state :standing, :initial => true
state :walking
state :running
event :walk do
transitions :from => :standing, :to => :walking
end
event :run do
transitions :from => [:standing, :walking], :to => :running
end
event ... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/double_definer.rb | spec/models/double_definer.rb | class DoubleDefiner
include AASM
aasm do
state :started
state :finished
event :finish do
transitions :from => :started, :to => :finished
end
# simulating a reload
state :finished, :before_enter => :do_enter
event :finish do
transitions :from => :started, :to => :finished, ... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/process_with_new_dsl.rb | spec/models/process_with_new_dsl.rb | class ProcessWithNewDsl
include AASM
def self.state(*args)
raise "wrong state method"
end
attr_accessor :flagged
aasm do
state :sleeping, :initial => true
state :running, :after_enter => :flag
state :suspended
event :start do
transitions :from => :sleeping, :to => :running
en... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/timestamps_with_named_machine_example.rb | spec/models/timestamps_with_named_machine_example.rb | class TimestampsWithNamedMachineExample
include AASM
attr_accessor :opened_at
aasm :my_state, timestamps: true do
state :opened
event :open do
transitions to: :opened
end
end
end
| ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/conversation.rb | spec/models/conversation.rb | class Conversation
include AASM
aasm do
state :needs_attention, :initial => true
state :read
state :closed
state :awaiting_response
state :junk
event :new_message do
end
event :view do
transitions :to => :read, :from => [:needs_attention]
end
event :reply do
end... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/complex_example.rb | spec/models/complex_example.rb | class ComplexExample
include AASM
attr_accessor :activation_code, :activated_at, :deleted_at
aasm do
state :passive
state :pending, :initial => true, :before_enter => :make_activation_code
state :active, :before_enter => :do_activate
state :suspended
state :deleted, :before_enter => :do_del... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/basic_two_state_machines_example.rb | spec/models/basic_two_state_machines_example.rb | class BasicTwoStateMachinesExample
include AASM
aasm :search do
state :initialised, :initial => true
state :queried
state :requested
event :query do
transitions :from => [:initialised, :requested], :to => :queried
end
event :request do
transitions :from => :queried, :to => :req... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/simple_example_with_guard_args.rb | spec/models/simple_example_with_guard_args.rb | class SimpleExampleWithGuardArgs
include AASM
aasm do
state :initialised, :initial => true
state :filled_out_with_args
event :fill_out_with_args do
transitions :guard => [:arg_is_valid?],
:from => :initialised,
:to => :filled_out_with_args
end
end
def ... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/initial_state_proc.rb | spec/models/initial_state_proc.rb | class InitialStateProc
RICH = 1_000_000
attr_accessor :balance
include AASM
aasm do
state :retired
state :selling_bad_mortgages
initial_state Proc.new { |banker| banker.rich? ? :retired : :selling_bad_mortgages }
end
def initialize(balance = 0); self.balance = balance; end
def rich?; self.b... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/provided_state.rb | spec/models/provided_state.rb | class ProvidedState
attr_accessor :transient_store, :persisted_store
include AASM
aasm do
state :alpha, :initial => true
state :beta
state :gamma
event :release do
transitions :from => [:alpha, :beta, :gamma], :to => :beta
end
end
def aasm_read_state(*args)
:beta
end
def aa... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/guard_with_params_multiple.rb | spec/models/guard_with_params_multiple.rb | class GuardWithParamsMultiple
include AASM
aasm(:left) do
state :new, :reviewed, :finalized
event :mark_as_reviewed do
transitions :from => :new, :to => :reviewed, :guards => [:user_is_manager?]
end
end
def user_is_manager?(user)
ok = false
if user.has_role? :manager
ok = true
... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/default_state.rb | spec/models/default_state.rb | class DefaultState
attr_accessor :transient_store, :persisted_store
include AASM
aasm do
state :alpha, :initial => true, display: 'ALPHA'
state :beta
state :gamma
event :release do
transitions :from => [:alpha, :beta, :gamma], :to => :beta
end
end
end
| ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/timestamps_example.rb | spec/models/timestamps_example.rb | class TimestampsExample
include AASM
attr_accessor :opened_at
attr_reader :closed_at
aasm timestamps: true do
state :opened
state :closed
event :open do
transitions to: :opened
end
event :close do
transitions to: :closed
end
end
end
| ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/guard_with_params.rb | spec/models/guard_with_params.rb | class GuardWithParams
include AASM
aasm do
state :new, :reviewed, :finalized
event :mark_as_reviewed do
transitions :from => :new, :to => :reviewed, :guards => [:user_is_manager?]
end
end
def user_is_manager?(user)
ok = false
if user && user.has_role?(:manager)
ok = true
en... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/namespaced_multiple_example.rb | spec/models/namespaced_multiple_example.rb | class NamespacedMultipleExample
include AASM
aasm(:status) do
state :unapproved, :initial => true
state :approved
event :approve do
transitions :from => :unapproved, :to => :approved
end
event :unapprove do
transitions :from => :approved, :to => :unapproved
end
end
aasm(:r... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/super_class.rb | spec/models/super_class.rb | class SuperClass
include AASM
aasm do
state :read
state :ended
event :foo do
transitions :to => :ended, :from => [:read]
end
end
def update_state
if may_foo?
foo!
end
end
end
class SuperClassMultiple
include AASM
aasm(:left) do
state :read
state :ended
... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/dynamoid/dynamoid_simple.rb | spec/models/dynamoid/dynamoid_simple.rb | class DynamoidSimple
include Dynamoid::Document
include AASM
field :status
attr_accessor :default
aasm :column => :status
aasm do
state :alpha, :initial => true
state :beta
state :gamma
event :release do
transitions :from => [:alpha, :beta, :gamma], :to => :beta
end
end
end
| ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/dynamoid/dynamoid_multiple.rb | spec/models/dynamoid/dynamoid_multiple.rb | class DynamoidMultiple
include Dynamoid::Document
include AASM
field :status
attr_accessor :default
aasm :left, :column => :status
aasm :left do
state :alpha, :initial => true
state :beta
state :gamma
event :release do
transitions :from => [:alpha, :beta, :gamma], :to => :beta
e... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/dynamoid/complex_dynamoid_example.rb | spec/models/dynamoid/complex_dynamoid_example.rb | class ComplexDynamoidExample
include Dynamoid::Document
include AASM
field :left
field :right
aasm :left, :column => 'left' do
state :one, :initial => true
state :two
state :three
event :increment do
transitions :from => :one, :to => :two
transitions :from => :two, :to => :three... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/nobrainer/complex_no_brainer_example.rb | spec/models/nobrainer/complex_no_brainer_example.rb | class ComplexNoBrainerExample
include NoBrainer::Document
include AASM
field :left, type: String
field :right, type: String
aasm :left, column: 'left' do
state :one, initial: true
state :two
state :three
event :increment do
transitions from: :one, to: :two
transitions from: :two... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/nobrainer/no_scope_no_brainer.rb | spec/models/nobrainer/no_scope_no_brainer.rb | class NoScopeNoBrainer
include NoBrainer::Document
include AASM
field :status, type: String
aasm create_scopes: false, column: :status do
state :ignored_scope
end
end
class NoScopeNoBrainerMultiple
include NoBrainer::Document
include AASM
field :status, type: String
aasm :left, create_scopes:... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/nobrainer/simple_new_dsl_nobrainer.rb | spec/models/nobrainer/simple_new_dsl_nobrainer.rb | class SimpleNewDslNoBrainer
include NoBrainer::Document
include AASM
field :status, type: String
aasm column: :status
aasm do
state :unknown_scope, initial: true
state :new
end
end
class SimpleNewDslNoBrainerMultiple
include NoBrainer::Document
include AASM
field :status, type: String
a... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/nobrainer/invalid_persistor_no_brainer.rb | spec/models/nobrainer/invalid_persistor_no_brainer.rb | class InvalidPersistorNoBrainer
include NoBrainer::Document
include AASM
field :name
field :status
aasm :left, column: :status, skip_validation_on_save: true do
state :sleeping, initial: true
state :running
event :run do
transitions to: :running, from: :sleeping
end
event :sleep do... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/nobrainer/nobrainer_relationships.rb | spec/models/nobrainer/nobrainer_relationships.rb | class Parent
include NoBrainer::Document
include AASM
field :status, type: String
has_many :childs
aasm column: :status do
state :unknown_scope
state :new
end
end
class Child
include NoBrainer::Document
include AASM
field :status, type: String
belongs_to :parent
aasm column: :status d... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/nobrainer/simple_no_brainer.rb | spec/models/nobrainer/simple_no_brainer.rb | class SimpleNoBrainer
include NoBrainer::Document
include AASM
field :status, type: String
aasm column: :status do
state :unknown_scope, :another_unknown_scope
state :new
end
end
class SimpleNoBrainerMultiple
include NoBrainer::Document
include AASM
field :status, type: String
aasm :left,... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/nobrainer/silent_persistor_no_brainer.rb | spec/models/nobrainer/silent_persistor_no_brainer.rb | class SilentPersistorNoBrainer
include NoBrainer::Document
include AASM
field :name
field :status
aasm :left, column: :status, whiny_persistence: false do
state :sleeping, initial: true
state :running
event :run do
transitions to: :running, from: :sleeping
end
event :sleep do
... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/nobrainer/validator_no_brainer.rb | spec/models/nobrainer/validator_no_brainer.rb | class ValidatorNoBrainer
include NoBrainer::Document
include AASM
field :name
field :status
attr_accessor :invalid
validate do |_|
errors.add(:validator, 'invalid') if invalid
end
aasm column: :status, whiny_persistence: true do
before_all_transactions :before_all_transactions
after_all_... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/mongoid/timestamp_example_mongoid.rb | spec/models/mongoid/timestamp_example_mongoid.rb | class TimestampExampleMongoid
include Mongoid::Document
include AASM
field :status, type: String
field :opened_at, type: Time
aasm column: :status, timestamps: true do
state :opened
state :closed
event :open do
transitions to: :opened
end
event :close do
transitions to: :cl... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/mongoid/simple_mongoid.rb | spec/models/mongoid/simple_mongoid.rb | class SimpleMongoid
include Mongoid::Document
include AASM
field :status, :type => String
aasm column: :status do
state :unknown_scope, :another_unknown_scope
state :new
end
end
class SimpleMongoidMultiple
include Mongoid::Document
include AASM
field :status, :type => String
aasm :left, c... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/mongoid/mongoid_relationships.rb | spec/models/mongoid/mongoid_relationships.rb | class Parent
include Mongoid::Document
include AASM
field :status, :type => String
has_many :childs
aasm column: :status do
state :unknown_scope
state :new
end
end
class Child
include Mongoid::Document
include AASM
field :parent_id
field :status, :type => String
belongs_to :parent
a... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/mongoid/silent_persistor_mongoid.rb | spec/models/mongoid/silent_persistor_mongoid.rb | class SilentPersistorMongoid
include Mongoid::Document
include AASM
field :name
field :status
aasm :left, column: :status, whiny_persistence: false do
state :sleeping, :initial => true
state :running
event :run do
transitions :to => :running, :from => :sleeping
end
event :sleep do
... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/mongoid/no_scope_mongoid.rb | spec/models/mongoid/no_scope_mongoid.rb | class NoScopeMongoid
include Mongoid::Document
include AASM
field :status, :type => String
aasm :create_scopes => false, :column => :status do
state :ignored_scope
end
end
class NoScopeMongoidMultiple
include Mongoid::Document
include AASM
field :status, :type => String
aasm :left, :create_sc... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/mongoid/invalid_persistor_mongoid.rb | spec/models/mongoid/invalid_persistor_mongoid.rb | class InvalidPersistorMongoid
include Mongoid::Document
include AASM
field :name
field :status
aasm :left, column: :status, skip_validation_on_save: true do
state :sleeping, :initial => true
state :running
event :run do
transitions :to => :running, :from => :sleeping
end
event :sle... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/mongoid/simple_new_dsl_mongoid.rb | spec/models/mongoid/simple_new_dsl_mongoid.rb | class SimpleNewDslMongoid
include Mongoid::Document
include AASM
field :status, :type => String
aasm :column => :status
aasm do
state :unknown_scope, :initial => true
state :new
end
end
class SimpleNewDslMongoidMultiple
include Mongoid::Document
include AASM
field :status, :type => String
... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/mongoid/validator_mongoid.rb | spec/models/mongoid/validator_mongoid.rb | class ValidatorMongoid
include Mongoid::Document
include AASM
field :name
field :status
attr_accessor :invalid
validate do |model|
errors.add(:validator, "invalid") if invalid
end
include AASM
aasm :column => :status, :whiny_persistence => true do
before_all_transactions :before_all_trans... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/mongoid/complex_mongoid_example.rb | spec/models/mongoid/complex_mongoid_example.rb | class ComplexMongoidExample
include Mongoid::Document
include AASM
field :left, :type => String
field :right, :type => String
aasm :left, :column => 'left' do
state :one, :initial => true
state :two
state :three
event :increment do
transitions :from => :one, :to => :two
transiti... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/sequel/complex_sequel_example.rb | spec/models/sequel/complex_sequel_example.rb | db = Sequel::DATABASES.first || Sequel.connect(SEQUEL_DB)
# if you want to see the statements while running the spec enable the following line
# db.loggers << Logger.new($stderr)
db.create_table(:complex_sequel_examples) do
primary_key :id
String :left
String :right
end
module Sequel
class ComplexExample < Sequ... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/sequel/sequel_simple.rb | spec/models/sequel/sequel_simple.rb | db = Sequel::DATABASES.first || Sequel.connect(SEQUEL_DB)
# if you want to see the statements while running the spec enable the following line
# db.loggers << Logger.new($stderr)
db.create_table(:simples) do
primary_key :id
String :status
end
module Sequel
class Simple < Sequel::Model(:simples)
include AASM... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/sequel/silent_persistor.rb | spec/models/sequel/silent_persistor.rb | db = Sequel::DATABASES.first || Sequel.connect(SEQUEL_DB)
[:silent_persistors, :multiple_silent_persistors].each do |t|
db.create_table(t) do
primary_key :id
String "name"
String "status"
end
end
module Sequel
class SilentPersistor < Sequel::Model(:silent_persistors)
plugin :validation_helpers
... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/sequel/transactor.rb | spec/models/sequel/transactor.rb | db = Sequel::DATABASES.first || Sequel.connect(SEQUEL_DB)
[:transactors, :no_lock_transactors, :lock_transactors, :lock_no_wait_transactors, :multiple_transactors].each do |table_name|
db.create_table(table_name) do
primary_key :id
String "name"
String "status"
Fixnum "worker_id"
end
end
module Se... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/sequel/sequel_multiple.rb | spec/models/sequel/sequel_multiple.rb | db = Sequel::DATABASES.first || Sequel.connect(SEQUEL_DB)
# if you want to see the statements while running the spec enable the following line
# db.loggers << Logger.new($stderr)
db.create_table(:multiples) do
primary_key :id
String :status
end
module Sequel
class Multiple < Sequel::Model(:multiples)
include... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/sequel/invalid_persistor.rb | spec/models/sequel/invalid_persistor.rb | db = Sequel::DATABASES.first || Sequel.connect(SEQUEL_DB)
[:invalid_persistors, :multiple_invalid_persistors].each do |table_name|
db.create_table(table_name) do
primary_key :id
String "name"
String "status"
end
end
module Sequel
class InvalidPersistor < Sequel::Model(:invalid_persistors)
plugin... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/sequel/validator.rb | spec/models/sequel/validator.rb | db = Sequel::DATABASES.first || Sequel.connect(SEQUEL_DB)
db.create_table(:validators) do
primary_key :id
String "name"
String "status"
Fixnum "worker_id"
end
module Sequel
class Validator < Sequel::Model(:validators)
plugin :validation_helpers
attr_accessor :after_all_transactions_performed,
... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/sequel/worker.rb | spec/models/sequel/worker.rb | db = Sequel::DATABASES.first || Sequel.connect(SEQUEL_DB)
db.create_table(:workers) do
primary_key :id
String "name"
String "status"
end
module Sequel
class Worker < Sequel::Model(:workers)
end
end
| ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/redis/complex_redis_example.rb | spec/models/redis/complex_redis_example.rb | class RedisComplexExample
include Redis::Objects
include AASM
value :left
value :right
def id
1
end
aasm :left, :column => 'left' do
state :one, :initial => true
state :two
state :three
event :increment do
transitions :from => :one, :to => :two
transitions :from => :two... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/redis/redis_multiple.rb | spec/models/redis/redis_multiple.rb | class RedisMultiple
include Redis::Objects
include AASM
value :status
def id
1
end
aasm :left, :column => :status
aasm :left do
state :alpha, :initial => true
state :beta
state :gamma
event :release do
transitions :from => [:alpha, :beta, :gamma], :to => :beta
end
end
en... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/redis/redis_simple.rb | spec/models/redis/redis_simple.rb | class RedisSimple
include Redis::Objects
include AASM
value :status
def id
1
end
aasm :column => :status
aasm do
state :alpha, :initial => true
state :beta
state :gamma
event :release do
transitions :from => [:alpha, :beta, :gamma], :to => :beta
end
end
end
| ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/callbacks/private_method_multiple.rb | spec/models/callbacks/private_method_multiple.rb | module Callbacks
class PrivateMethodMultiple
include AASM
def initialize(options={})
@fail_event_guard = options[:fail_event_guard]
@fail_transition_guard = options[:fail_transition_guard]
@log = options[:log]
reset_data
end
def reset_data
@data = []
end
def da... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/callbacks/with_state_arg_multiple.rb | spec/models/callbacks/with_state_arg_multiple.rb | module Callbacks
class WithStateArgMultiple
include AASM
aasm(:left) do
state :open, :initial => true
state :closed
state :out_to_lunch
event :close, :before => :before_method, :after => :after_method, :before_success => :before_success_method, :success => :success_method do
... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/callbacks/guard_within_block_multiple.rb | spec/models/callbacks/guard_within_block_multiple.rb | module Callbacks
class GuardWithinBlockMultiple
include AASM
def initialize(options={})
@fail_event_guard = options[:fail_event_guard]
@fail_transition_guard = options[:fail_transition_guard]
@log = options[:log]
end
aasm(:left) do
state :open, :initial => true,
:befo... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/callbacks/private_method.rb | spec/models/callbacks/private_method.rb | module Callbacks
class PrivateMethod
include AASM
def initialize(options={})
@fail_event_guard = options[:fail_event_guard]
@fail_transition_guard = options[:fail_transition_guard]
@log = options[:log]
reset_data
end
def reset_data
@data = []
end
def data
... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/callbacks/multiple_transitions_transition_guard_multiple.rb | spec/models/callbacks/multiple_transitions_transition_guard_multiple.rb | module Callbacks
class MultipleTransitionsTransitionGuardMultiple
include AASM
def initialize(options={})
@fail_event_guard = options[:fail_event_guard]
@fail_transition_guard = options[:fail_transition_guard]
@log = options[:log]
end
aasm(:left) do
state :open, :initial => t... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/callbacks/with_state_arg.rb | spec/models/callbacks/with_state_arg.rb | module Callbacks
class WithStateArg
include AASM
aasm do
state :open, :initial => true
state :closed
state :out_to_lunch
event :close, :before => :before_method, :after => :after_method, :before_success => :before_success_method, :success => :success_method3 do
transitions :... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/callbacks/basic.rb | spec/models/callbacks/basic.rb | module Callbacks
class Basic
include AASM
def initialize(options={})
@fail_event_guard = options[:fail_event_guard]
@fail_transition_guard = options[:fail_transition_guard]
@log = options[:log]
reset_data
end
def reset_data
@data = []
end
def data
@data.j... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/callbacks/multiple_transitions_transition_guard.rb | spec/models/callbacks/multiple_transitions_transition_guard.rb | module Callbacks
class MultipleTransitionsTransitionGuard
include AASM
def initialize(options={})
@fail_event_guard = options[:fail_event_guard]
@fail_transition_guard = options[:fail_transition_guard]
@log = options[:log]
end
aasm do
state :open, :initial => true,
:b... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/callbacks/basic_multiple.rb | spec/models/callbacks/basic_multiple.rb | module Callbacks
class BasicMultiple
include AASM
def initialize(options={})
@fail_event_guard = options[:fail_event_guard]
@fail_transition_guard = options[:fail_transition_guard]
@log = options[:log]
reset_data
end
def reset_data
@data = []
end
def data
... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/callbacks/with_args_multiple.rb | spec/models/callbacks/with_args_multiple.rb | module Callbacks
class WithArgsMultiple
include AASM
def initialize(options={})
@log = options[:log]
reset_data
end
def reset_data
@data = []
end
def data
@data.join(' ')
end
aasm(:left) do
state :open, :initial => true,
:before_enter => :befor... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/callbacks/with_args.rb | spec/models/callbacks/with_args.rb | module Callbacks
class WithArgs
include AASM
def initialize(options={})
@log = options[:log]
reset_data
end
def reset_data
@data = []
end
def data
@data.join(' ')
end
aasm do
state :open, :initial => true,
:before_enter => :before_enter_open,
... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/callbacks/guard_within_block.rb | spec/models/callbacks/guard_within_block.rb | module Callbacks
class GuardWithinBlock
include AASM
def initialize(options={})
@fail_event_guard = options[:fail_event_guard]
@fail_transition_guard = options[:fail_transition_guard]
@log = options[:log]
end
aasm do
state :open, :initial => true,
:before_enter => :be... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/not_auto_loaded/process.rb | spec/models/not_auto_loaded/process.rb | module Models
class Process
include AASM
aasm do
state :sleeping
state :running
state :suspended
event :start do
transitions :from => :sleeping, :to => :running
end
event :stop do
transitions :from => :running, :to => :suspended
end
end
end
e... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/active_record/with_false_enum.rb | spec/models/active_record/with_false_enum.rb | class WithFalseEnum < ActiveRecord::Base
include AASM
# Fake this column for testing purposes
attr_accessor :aasm_state
aasm :enum => false do
state :opened
state :closed
event :view do
transitions :to => :read, :from => [:needs_attention]
end
end
end
class MultipleWithFalseEnum < Ac... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/active_record/no_direct_assignment.rb | spec/models/active_record/no_direct_assignment.rb | class NoDirectAssignment < ActiveRecord::Base
include AASM
aasm :no_direct_assignment => true do
state :pending, :initial => true
state :running
event :run do
transitions :from => :pending, :to => :running
end
end
end
class MultipleNoDirectAssignment < ActiveRecord::Base
include AASM
aa... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/active_record/instance_level_skip_validation_example.rb | spec/models/active_record/instance_level_skip_validation_example.rb | class InstanceLevelSkipValidationExample < ActiveRecord::Base
include AASM
aasm :state do
state :new, :initial => true
state :draft
state :complete
event :set_draft do
transitions from: :new, to: :draft
end
event :complete do
transitions from: %i[draft new], to: :complete
... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/active_record/timestamp_example.rb | spec/models/active_record/timestamp_example.rb | class TimestampExample < ActiveRecord::Base
include AASM
aasm column: :aasm_state, timestamps: true do
state :opened
state :closed
event :open do
transitions to: :opened
end
event :close do
transitions to: :closed
end
end
end
| ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/active_record/derivate_new_dsl.rb | spec/models/active_record/derivate_new_dsl.rb | require_relative 'simple_new_dsl'
class DerivateNewDsl < SimpleNewDsl
end
class MultipleDerivateNewDsl < MultipleSimpleNewDsl
end
| ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/active_record/no_scope.rb | spec/models/active_record/no_scope.rb | class NoScope < ActiveRecord::Base
include AASM
aasm :create_scopes => false do
state :pending, :initial => true
state :running
event :run do
transitions :from => :pending, :to => :running
end
end
end
class MultipleNoScope < ActiveRecord::Base
include AASM
aasm :left, :column => :aasm_s... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/active_record/namespaced.rb | spec/models/active_record/namespaced.rb | class MultipleNamespaced < ActiveRecord::Base
include AASM
aasm(:status, namespace: :car) do
state :unsold, initial: true
state :sold
event :sell do
transitions from: :unsold, to: :sold
end
event :return do
transitions from: :sold, to: :unsold
end
end
end
| ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/active_record/complex_active_record_example.rb | spec/models/active_record/complex_active_record_example.rb | 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
eve... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/active_record/active_record_callback.rb | spec/models/active_record/active_record_callback.rb | class ActiveRecordCallback < ActiveRecord::Base
include AASM
def reset_data
@data = []
end
def data
@data.join(' ')
end
aasm column: :status do
before_all_events :before_all_events
after_all_events :after_all_events
ensure_on_all_events :ensure_on_all_events
after_... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/active_record/false_state.rb | spec/models/active_record/false_state.rb | class FalseState < ActiveRecord::Base
include AASM
def initialize(*args)
super
self.aasm_state = false
end
aasm do
state :opened
state :closed
event :view do
transitions :to => :read, :from => [:needs_attention]
end
end
end
class MultipleFalseState < ActiveRecord::Base
incl... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/active_record/persisted_state.rb | spec/models/active_record/persisted_state.rb | class PersistedState < ActiveRecord::Base
attr_accessor :transient_store, :persisted_store
include AASM
aasm do
state :alpha, :initial => true
state :beta
state :gamma
event :release do
transitions :from => [:alpha, :beta, :gamma], :to => :beta
end
end
end
| ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/active_record/silent_persistor.rb | spec/models/active_record/silent_persistor.rb | class SilentPersistor < ActiveRecord::Base
include AASM
aasm :column => :status, :whiny_persistence => false do
state :sleeping, :initial => true
state :running
event :run do
transitions :to => :running, :from => :sleeping
end
event :sleep do
transitions :to => :sleeping, :from => :r... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/active_record/reader.rb | spec/models/active_record/reader.rb | class Reader < ActiveRecord::Base
include AASM
def aasm_read_state
"fi"
end
end
| ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/active_record/thief.rb | spec/models/active_record/thief.rb | class Thief < ActiveRecord::Base
if ActiveRecord::VERSION::MAJOR >= 3
self.table_name = 'thieves'
else
set_table_name "thieves"
end
include AASM
aasm do
state :rich
state :jailed
initial_state Proc.new {|thief| thief.skilled ? :rich : :jailed }
end
attr_accessor :skilled, :aasm_state
e... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/active_record/with_enum.rb | spec/models/active_record/with_enum.rb | class WithEnum < ActiveRecord::Base
include AASM
# Fake this column for testing purposes
attr_accessor :aasm_state
def self.test
{}
end
aasm :enum => :test do
state :opened
state :closed
event :view do
transitions :to => :read, :from => [:needs_attention]
end
end
end
class M... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/active_record/with_true_enum.rb | spec/models/active_record/with_true_enum.rb | class WithTrueEnum < ActiveRecord::Base
include AASM
# Fake this column for testing purposes
attr_accessor :aasm_state
def value
'value'
end
aasm :enum => true do
state :opened
state :closed
event :view do
transitions :to => :read, :from => [:needs_attention]
end
end
end
cla... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/active_record/readme_job.rb | spec/models/active_record/readme_job.rb | class ReadmeJob < ActiveRecord::Base
include AASM
aasm do
state :sleeping, :initial => true
state :running
state :cleaning
event :run do
transitions :from => :sleeping, :to => :running
end
event :clean do
transitions :from => :running, :to => :cleaning
end
event :slee... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/active_record/transactor.rb | spec/models/active_record/transactor.rb | class Transactor < ActiveRecord::Base
belongs_to :worker
include AASM
aasm :column => :status do
state :sleeping, :initial => true
state :running, :before_enter => :start_worker, :after_enter => :fail
event :run do
transitions :to => :running, :from => :sleeping
end
end
private
def ... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/active_record/writer.rb | spec/models/active_record/writer.rb | class Writer < ActiveRecord::Base
def aasm_write_state(state)
"fo"
end
include AASM
end
| ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/active_record/invalid_persistor.rb | spec/models/active_record/invalid_persistor.rb | class InvalidPersistor < ActiveRecord::Base
include AASM
aasm :column => :status, :skip_validation_on_save => true do
state :sleeping, :initial => true
state :running
event :run do
transitions :to => :running, :from => :sleeping
end
event :sleep do
transitions :to => :sleeping, :from... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/active_record/validator.rb | spec/models/active_record/validator.rb | class Validator < ActiveRecord::Base
attr_accessor :after_all_transactions_performed,
:after_transaction_performed_on_fail,
:after_transaction_performed_on_fail_with_reason,
:after_transaction_performed_on_run,
:before_all_transactions_performed,
:before_transaction_performed_on_fail,
:before_... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
aasm/aasm | https://github.com/aasm/aasm/blob/726a578808e0f403bfd24e505f9a45319670a6b7/spec/models/active_record/provided_and_persisted_state.rb | spec/models/active_record/provided_and_persisted_state.rb | class ProvidedAndPersistedState < ActiveRecord::Base
attr_accessor :transient_store, :persisted_store
include AASM
aasm do
state :alpha, :initial => true
state :beta
state :gamma
event :release do
transitions :from => [:alpha, :beta, :gamma], :to => :beta
end
end
def aasm_read_state... | ruby | MIT | 726a578808e0f403bfd24e505f9a45319670a6b7 | 2026-01-04T15:43:55.088186Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.