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.