I m using the rubyist-aasm state machine for handling the different states in my Event object (event initialized, event discussed, event published, etc.). I added guards to prevent state changes when certain conditions aren t met.
This all works fine but it doesn t show any errors when a state change was rejected by the guard. Any idea how I can see the state didn t change? I could check the states manually but it 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