All threads / The State_Machine Gem Discussion

Ask A Question


You’re not receiving notifications from this thread.

The State_Machine Gem Discussion

Dicussion for The State_Machine Gem
Innokenty Longway ·

Awesome! Chris, this is very useful. Thank you.

Ganesh Kunwar ·

Thanks Chris for your useful Screencasts video. This is very useful.


thanks Chris for this info, very useful.


This was really good I love hearing/learning/ finding out about these little things that I dont think about or know about yet being a fresh programmer. From an experienced programmer, what would maybe be a cool app to make to help with practicing this even if it was just in one ruby file.

I think coming up with a simple 'idea' or 'game' to build to practice the idea comes so hard so that would be helpfull thanks man for all your services!

A crazy in-depth example is this for video games:

They are a fantastic use case for state machines because you've got to keep track of so many things when it comes to power ups. Take just the ghosts in pacman for example:

I would say that if you want to try this out, try building a soda machine where you type in the various coins you put into the machine and it counts up and dispenses the soda (and change) once you've hit the correct price. You can just write these events out as strings into the console and that would be a good first experience with it.

Great response thanks man I'm going to try that out!


I think is the latest version for rails. Why don't you use it?

I think you are right! I have just not used the gem that often since the last time and this wasn't available then. It does seem to be a community supported version that is the most up to date. Thanks for sharing!


Hi Chris! Would it be possible to do more videos on state machines in regard to multiple conditions for each event and also something on views? Thanks a bunch!

Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 53,130+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2021 GoRails, LLC. All rights reserved.