I use the rubyist-aasm state machine to handle various states in the Event object (event is initialized, event is discussed, event is published, etc.). I added guards to prevent state changes when certain conditions are not met.
All this works fine, but it does not show any errors when the guard rejected the state change. Any idea how I can see the condition has not changed? I could check the states manually, but that sounds like an ugly solution.
aasm_state :firststate
aasm_state :secondstate
aasm_event :approve do
transitions :to => :secondstate, :from => [:firststate], :guard => :has_a_price?
end
def has_a_price?
self.price.present?
end
source
share