# aasm callback order?

**URL:** <https://discuss.rubyonrails.org/t/aasm-callback-order/35781>\
**Category:** rubyonrails-talk\
**Created:** [October 28, 2008, 12:31am UTC](https://discuss.rubyonrails.org/t/aasm-callback-order/35781 "2008-10-28T00:31:00Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dan\_Sharp](https://avatars.discourse-cdn.com/v4/letter/d/c68b51/32.png) [@Dan\_Sharp](https://discuss.rubyonrails.org/u/Dan_Sharp)\
**Post date:** [October 28, 2008, 12:31am UTC](https://discuss.rubyonrails.org/t/aasm-callback-order/35781/1 "2008-10-28T00:31:00Z")

</div>

Hello!

Sometime ago I ran across a webpage where someone had identified the full callback sequence for an object lifecycle including AASM with it's :enter and :exit and whatnot callbacks. Unfortunately, I can't find it and searches don't seem to help.

Does anyone have a reference to a page that shows the callback sequence with Acts As State Machine (the gem)?

I think there was a Wiki page on github with this, but I can't find it. Grrr.

Thanks!

-Danimal

---

<div class="post-metadata">

**Author:** ![Robert\_Zotter](https://avatars.discourse-cdn.com/v4/letter/r/73ab20/32.png) [@Robert\_Zotter](https://discuss.rubyonrails.org/u/Robert_Zotter)\
**Post date:** [October 28, 2008, 12:42am UTC](https://discuss.rubyonrails.org/t/aasm-callback-order/35781/2 "2008-10-28T00:42:58Z")

</div>

Danimal,

Usually the best place to look is the actual source itself. [http://github.com/omghax/acts\_as\_state\_machine/tree/master/lib/acts\_as\_state\_machine.rb](http://github.com/omghax/acts_as_state_machine/tree/master/lib/acts_as_state_machine.rb)

Looks like this is what you are looking for :entering :entered :exited

The entering and exiting methods call the @enter and @exit options respectively which are passed in during instantiation.

Cheers

---

<div class="post-metadata">

**Author:** ![Dan\_Sharp](https://avatars.discourse-cdn.com/v4/letter/d/c68b51/32.png) [@Dan\_Sharp](https://discuss.rubyonrails.org/u/Dan_Sharp)\
**Post date:** [October 28, 2008, 12:48am UTC](https://discuss.rubyonrails.org/t/aasm-callback-order/35781/3 "2008-10-28T00:48:06Z")

</div>

Robert,

I appreciate the fast response. Actually, though, there was a page somewhere that showed the FULL lifecycle of a ruby model that goes through before\_save, validation, after\_save, and all that along with the AASM transitions when the bang (!) character is included and when enters, exits, guards, transitions and such are used.

I can practically visualize the page I remember... it was a listing of the order of each of these "steps" (callbacks and such).

In other words, it was very similar to the first part of this: [http://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html](http://api.rubyonrails.org/classes/ActiveRecord/Callbacks.html) but with the AASM hooks included.

It's just bugging me because I thought I bookmarked the page and I can't find my bookmark. \*sigh\*

-Danimal

---

<div class="post-metadata">

**Author:** ![Robert\_Zotter](https://avatars.discourse-cdn.com/v4/letter/r/73ab20/32.png) [@Robert\_Zotter](https://discuss.rubyonrails.org/u/Robert_Zotter)\
**Post date:** [October 28, 2008, 12:52am UTC](https://discuss.rubyonrails.org/t/aasm-callback-order/35781/4 "2008-10-28T00:52:21Z")

</div>

Ahhh I see. Sorry, Im not familiar with that wiki you are talking about. However I can solve your bookmarking problem if you happen to use Firefox [http://www.foxmarks.com/](http://www.foxmarks.com/)🙂

Good luck finding that wiki.

---

<div class="post-metadata">

**Author:** ![Dan\_Sharp](https://avatars.discourse-cdn.com/v4/letter/d/c68b51/32.png) [@Dan\_Sharp](https://discuss.rubyonrails.org/u/Dan_Sharp)\
**Post date:** [October 28, 2008, 12:55am UTC](https://discuss.rubyonrails.org/t/aasm-callback-order/35781/5 "2008-10-28T00:55:56Z")

</div>

Thank you, Robert! I'll have to try out foxmarks. I suspect that the problem was PEBKAC... i.e. I probably thought "that's a cool page, I should bookmark it" and for whatever reason did not. Heh.

Anyway... anyone else have an inkling about the page/wiki that I'm talking about? Or was it just in a dream?

🙂

-Danimal

---

<div class="post-metadata">

**Author:** ![dusty](https://avatars.discourse-cdn.com/v4/letter/d/a183cd/32.png) [@dusty](https://discuss.rubyonrails.org/u/dusty)\
**Post date:** [December 1, 2008, 7:26pm UTC](https://discuss.rubyonrails.org/t/aasm-callback-order/35781/6 "2008-12-01T19:26:25Z")

</div>

Is this it?

[http://didcoe.id.au/archives/finite-state-machines-in-rails](http://didcoe.id.au/archives/finite-state-machines-in-rails)

---

<div class="post-metadata">

**Author:** ![Dan\_Sharp](https://avatars.discourse-cdn.com/v4/letter/d/c68b51/32.png) [@Dan\_Sharp](https://discuss.rubyonrails.org/u/Dan_Sharp)\
**Post date:** [December 2, 2008, 4:54am UTC](https://discuss.rubyonrails.org/t/aasm-callback-order/35781/7 "2008-12-02T04:54:00Z")

</div>

Dusty,

That may very well be it. I thought it was a longer list, but maybe I'm just remembering the two lists (new vs. existing) and somehow lumping them together.

Thanks for the reference, though! 🙂

-Danimal

---

<div class="post-metadata">

**Author:** ![Ruby\_Freak](https://avatars.discourse-cdn.com/v4/letter/r/b782af/32.png) [@Ruby\_Freak](https://discuss.rubyonrails.org/u/Ruby_Freak)\
**Post date:** [December 2, 2008, 2:13pm UTC](https://discuss.rubyonrails.org/t/aasm-callback-order/35781/8 "2008-12-02T14:13:16Z")

</div>

This is a bit more verbose.

[http://blog.methodmissing.com/2006/11/16/beyond-callbacks-for-complex-model-lifecycles/](http://blog.methodmissing.com/2006/11/16/beyond-callbacks-for-complex-model-lifecycles/)
