It seems like a deceptively simple ask: is it possible to associate a human-friendly string with a machine-friendly state name in an event machine on Rails? I'm using AASM at the moment, but none of the event machine gems I've looked at seem to offer this.
I have weirdly-capitalized states, like "Sent to PE Review", which "flatten" to :sent_to_pe_review
as a state symbol. I can't easily get back to a properly-cased label for display on the object in a view, or in a dropdown select on a form. It seems to me that there should be an option like label: "Sent to PE Review"
on the definition of the state in the model, but I can't find any such reference.
I've resorted to creating a separate "status" field, and putting the appropriate string in it, depending on state, in a before_save
callback. That fixes the view, but not the dropdown list in the form for jumping states. As I contemplate rigging up some sort of collection with state symbols and label strings, the whole thing is feeling very non-Rails-like, and I'm thinking I'm missing something simple. What's the "Rails way" to do this?