Module: BigMachine::ActiveRecord
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/big_machine/active_record.rb
Defined Under Namespace
Modules: ClassMethods
Instance Method Summary collapse
Instance Method Details
#set_current_state(new_state_class) ⇒ Object
26 27 28 29 |
# File 'lib/big_machine/active_record.rb', line 26 def set_current_state(new_state_class) super(new_state_class) send "#{state_attribute}=", new_state_class.name end |
#set_current_state_from_db ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/big_machine/active_record.rb', line 17 def set_current_state_from_db return unless self.class.initial_state_class attribute = send state_attribute state_class = attribute ? attribute.constantize : self.class.initial_state_class set_current_state(state_class) end |