module AASM::Persistence::RedisPersistence::InstanceMethods

def aasm_read_state(name=:default)

This allows for nil aasm states - be sure to add validation to your model

NOTE: intended to be called from an event

foo.current_state # => nil
foo.aasm_state = nil
foo.current_state # => :opened
foo = Foo[1]

foo.current_state # => :closed
foo.close
foo.current_state # => :opened
foo = Foo.new

end
end
state :closed
state :opened
aasm :column => :status do
include AASM
include Redis::Objects
class Foo

If it's a new record, and the aasm state column is blank it returns the initial state

Returns the value of the aasm.attribute_name - called from aasm.current_state
def aasm_read_state(name=:default)
  state = send(self.class.aasm(name).attribute_name)
  if state.value.nil?
    nil
  else
    state.value.to_sym
  end
end