Method: Apollo::ActiveRecordExtensions::InstanceMethods#current_state=

Defined in:
lib/apollo/active_record_extensions.rb

#current_state=(new_value) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/apollo/active_record_extensions.rb', line 15

def current_state=(new_value)
  if self.class.persist_string_state_name?
    self[self.class.current_state_column] = new_value
  else
    self[self.class.current_state_id_column] = self.class.state_name_to_id(new_value)
 end
 self.save! unless self.new_record?
end