module AASM::Persistence::ActiveFedoraPersistence::InstanceMethods
Public Instance Methods
aasm_ensure_initial_state()
click to toggle source
# File lib/aasm-active_fedora/active_fedora_persistence.rb, line 43 def aasm_ensure_initial_state AASM::StateMachineStore.fetch(self.class, true).machine_names.each do |state_machine_name| if send(self.class.aasm(state_machine_name).attribute_name).nil? aasm(state_machine_name).enter_initial_state end end end
aasm_read_state(name=:default)
click to toggle source
# File lib/aasm-active_fedora/active_fedora_persistence.rb, line 51 def aasm_read_state(name=:default) current = send(self.class.aasm(name).attribute_name) return current.to_sym unless current.nil? initial_state = aasm(name).enter_initial_state set_value(self.class.aasm(name).attribute_name, initial_state) return initial_state end
aasm_write_state(new_state, name=:default)
click to toggle source
# File lib/aasm-active_fedora/active_fedora_persistence.rb, line 60 def aasm_write_state(new_state, name=:default) aasm_write_state_without_persistence(new_state, name) save end
aasm_write_state_without_persistence(new_state, name=:default)
click to toggle source
# File lib/aasm-active_fedora/active_fedora_persistence.rb, line 65 def aasm_write_state_without_persistence(new_state, name=:default) set_value(self.class.aasm(name).attribute_name, new_state) end