Skip to content

Commit

Permalink
keep it dry
Browse files Browse the repository at this point in the history
  • Loading branch information
alto committed Apr 28, 2013
1 parent 47e446f commit 29db910
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/aasm/persistence/base.rb
Expand Up @@ -33,10 +33,11 @@ def self.included(base) #:nodoc:
#
# 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

Expand Down

0 comments on commit 29db910

Please sign in to comment.