pluginaweek/state_machine — Issue #137: Are transition callbacks supposed to fire when state changes?
Author: aaronchi
Created: 2011-10-29 20:51:31+00:00
State: open

I have a model set up like this:

state_machine :state, :initial => :pending do
event :complete do
transition [:pending] => :unverified
end
event :verify do
transition [:pending, :unverified] => :verified
end
after_transition [:pending, :unverified] => :verified do |listing, transition|
listing.person.update_attribute(:member_type, :professional)
end
end

Right now, the transition only fires if I call `listing.verify!` but not if I update the state directly. Is this the intended behavior or should the model be recording state changes when done through a regular update?