I need a state machine for a message private system and order status system.
you can see these two gems:
https://github.com/pluginaweek/state_machine
https://github.com/rubyist/aasm
I'm using mongoid with mongodb database
What gem is most appropriate for this features?
Update:
Check out the recent RailsCast: A Tour of State Machines
One thing to mention is that when you use a state machine, it may make it difficult to generate objects for tests which are in an invalid state..
Previous Answer:
Both gems are working great, are compatible with Mongoid, and are actively maintained.
I've used AASM in the past, and it has been around a bit longer, but the state_machine gem has quite a bit more functionality and more options. e.g. check the methods generated by state_machine on the base class (below their example); you can define more details, e.g. transition callbacks, conditional transitions; you can do path analysis, there's even a GraphViz generator to generate a nice picture of your state graph.
If you need just a simple state machine, you can go with AASM. If you need to model more details like conditional transitions or transition callbacks, path analysis, do queries about the states a lot, or need nested state machines, then go for the state_machine gem.
References:
AASM : https://github.com/aasm/aasm
state_machine : https://github.com/pluginaweek/state_machine
Additional info about state_machine:
http://www.pluginaweek.org/2009/03/08/state_machine-one-machine-to-rule-them-all/
http://rdoc.info:8080/github/pluginaweek/state_machine/master/StateMachine/Machine