# Aasm manage states

**URL:** <https://www.ruby-forum.com/t/aasm-manage-states/191668>\
**Category:** Rails\
**Created:** [July 16, 2010, 12:54am UTC](https://www.ruby-forum.com/t/aasm-manage-states/191668 "2010-07-16T00:54:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bigdaddy71](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bbe5ce/32.png) [@bigdaddy71](https://www.ruby-forum.com/u/bigdaddy71)\
**Post date:** [July 16, 2010, 12:54am UTC](https://www.ruby-forum.com/t/aasm-manage-states/191668/1 "2010-07-16T00:54:33Z")

</div>

Is there a way to manage the states in AASM by keeping them in a table  
to normalize the data?

---

<div class="post-metadata">

**Author:** ![bigdaddy71](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bbe5ce/32.png) [@bigdaddy71](https://www.ruby-forum.com/u/bigdaddy71)\
**Post date:** [July 18, 2010, 12:56pm UTC](https://www.ruby-forum.com/t/aasm-manage-states/191668/2 "2010-07-18T12:56:42Z")

</div>

Not really sure, how to understand your question.

I was also wondering on how to use AASM to extend states during run-  
time. Is it this what you are asking?

---

<div class="post-metadata">

**Author:** ![bigdaddy71](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bbe5ce/32.png) [@bigdaddy71](https://www.ruby-forum.com/u/bigdaddy71)\
**Post date:** [July 18, 2010, 6:39pm UTC](https://www.ruby-forum.com/t/aasm-manage-states/191668/3 "2010-07-18T18:39:45Z")

</div>

Well sort of. Basically you have a ton of states that are defined in  
the model, is there away to take those stares and define them in the  
db and have a fk pointing back to the main model. Normalized db.  
Repeated data extrapolated into another table.

---

<div class="post-metadata">

**Author:** ![bigdaddy71](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bbe5ce/32.png) [@bigdaddy71](https://www.ruby-forum.com/u/bigdaddy71)\
**Post date:** [July 22, 2010, 8:36pm UTC](https://www.ruby-forum.com/t/aasm-manage-states/191668/4 "2010-07-22T20:36:12Z")

</div>

[Please quote when replying – otherwise, it’s hard to figure out what  
you’re replying to.]

Chris H. wrote:

> Well sort of. Basically you have a ton of states that are defined in  
> the model, is there away to take those stares and define them in the  
> db and have a fk pointing back to the main model. Normalized db.  
> Repeated data extrapolated into another table.

That’s easy enough to do in general. You were asking about AASM,  
though, and I’m not sure how to get that working without patching AASM.  
A patch shouldn’t be difficult, and I’ve also been bothered enough by  
AASM’s lack of normalization that I might write one at some point…

…but for now, I’ve kind of accepted the lack of normalization as the  
price to pay for easy AASM management. Perhaps an enumerated type would  
be a good compromise, if your DB supports it (there are plugins to get  
enumerated types working with Rails).

## Best,

Marnen Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid
