This is what I have:
state_machine :state, :initial => :open do
after_transition :on => :buy, :do => :send_buy_notification_email
after_transition :on => :take, :do => :send_take_notification_email
after_transition :on => :accept, :do => :send_accept_notification_email
after_transition :on => :cancel, :do => :send_cancel_notification_email
Now I’d like to trigger :send_trade_notification_email on the initial state open.
How do I do that?
Cheers,
Joel
Since the state transitions are analogous to the ‘usual’ AR callbacks, perhaps your method should be triggered in the after_create callback? After all, your transition is from nil to open which would happen on create:
Which, if it were allowed, would accomplish the same thing as: