Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Revert "Add write_state_without_persistence implementation"

This reverts commit 370488c.
  • Loading branch information...
commit eff0d859850b3f308e643ce570dcd10b70603548 1 parent 6a7cb6a
@troessner troessner authored
Showing with 5 additions and 8 deletions.
  1. +5 −8 lib/active_model/transitions.rb
View
13 lib/active_model/transitions.rb
@@ -45,19 +45,16 @@ def reload(options = nil)
protected
def write_state(state_machine, state)
+ ivar = state_machine.current_state_variable
prev_state = current_state(state_machine.name)
- write_state_without_persistence(state_machine, state)
+ instance_variable_set(ivar, state)
+ self.state = state.to_s
save!
rescue ActiveRecord::RecordInvalid
- write_state_without_persistence(state_machine, prev_state)
+ self.state = prev_state.to_s
+ instance_variable_set(ivar, prev_state)
raise
end
-
- def write_state_without_persistence(state_machine, state)
- ivar = state_machine.current_state_variable
- instance_variable_set(ivar, state)
- self.state = state.to_s
- end
def read_state(state_machine)
self.state && self.state.to_sym
Please sign in to comment.
Something went wrong with that request. Please try again.