1
0
Fork 0
mirror of https://github.com/aasm/aasm synced 2023-03-27 23:22:41 -04:00

keep it dry

This commit is contained in:
Thorsten Böttger 2013-04-28 22:22:19 +02:00
parent 47e446f501
commit 29db910861

View file

@ -33,10 +33,11 @@ module AASM
#
# This allows for nil aasm states - be sure to add validation to your model
def aasm_read_state
state = send(self.class.aasm_column)
if new_record?
send(self.class.aasm_column).blank? ? aasm.determine_state_name(self.class.aasm_initial_state) : send(self.class.aasm_column).to_sym
state.blank? ? aasm.determine_state_name(self.class.aasm_initial_state) : state.to_sym
else
send(self.class.aasm_column).nil? ? nil : send(self.class.aasm_column).to_sym
state.nil? ? nil : state.to_sym
end
end