Module: AASM::Persistence::MongoidPersistence::InstanceMethods

Defined in:
lib/aasm/persistence/mongoid_persistence.rb

Instance Method Summary collapse

Instance Method Details

#aasm_current_stateObject

Returns the current aasm_state of the object. Respects reload and any changes made to the aasm_state field directly

Internally just calls aasm_read_state

foo = Foo.find(1)
foo.aasm_current_state # => :pending
foo.aasm_state = "opened"
foo.aasm_current_state # => :opened
foo.close # => calls aasm_write_state_without_persistence
foo.aasm_current_state # => :closed
foo.reload
foo.aasm_current_state # => :pending


134
135
136
# File 'lib/aasm/persistence/mongoid_persistence.rb', line 134

def aasm_current_state
  @current_state = aasm_read_state
end