Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9133567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:30:37+00:00 2026-06-17T08:30:37+00:00

I am trying to write an application that will allow users to manage workflows

  • 0

I am trying to write an application that will allow users to manage workflows using the State Machine gem but I am not sure how to proceed in allowing users to define their own state machines using the State Machine gem for ruby.

In the dynamic definitions portion of the gem documentation it says that I should be able to do this by replacing code like this below with a data source.

   def transitions
    [
      {:parked => :idling, :on => :ignite},
      {:idling => :first_gear, :first_gear => :second_gear, :on => :shift_up}
      # ...
    ]
  end

I am not sure how to go about doing this. how do I define the transistions from a database?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T08:30:38+00:00Added an answer on June 17, 2026 at 8:30 am

    Because transitions is just a method, you could implement this any way you want. Here’s one possible way.

    I’ll assume you’re using ActiveRecord.

    Define a Transition model and an associated transitions table with to, from, and on columns, all strings. Then you can start defining transitions, e.g.:

    Transition.create(:from => "parked", :to => "idling", :on => "ignite")
    

    Then in your transitions method:

    def transitions
      transitions_data = []
      Transition.all.each do |transition|
        transitions_data << { transition.from.to_sym => transition.to.to_sym, :on => transition.on.to_sym }  
      end
      transitions_data
    end
    

    You can then use the other code in the documentation you linked to create a state machine dynamically.

    This is just one example, and could be much further optimized. I’ll leave that part to you. Hopefully this will give you a good start.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to write an application using Java that will allow me to
I'm trying to write an application that will allow a non-administrator user to create
I'm trying to write an application that will allow the user to start long-running
Hi I am trying to write an application that will play morse code. I
I am trying to write a small Java application that will let me run
I am trying to write a filter function for my application that will take
I am trying to write an application that will use PHP as a scripting
Background I'm trying to write an application in C++ that will run on Vista.
I am trying to write an application that will access, and change, entries in
I am trying to write a Java application that will query the WMI on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.