You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
At the moment state_machine_enum relies on Postgres enums. The values for the enum attribute are collected from the collector, but there is no way to map them either to specific integers (closed: 0, open: 1) or to strings (closed: "CLOSED", open: "OPEN") as they are picked up from the Collector. At the moment the only mapping we support is from string to itself - closed: "closed", open: "open"} We need a way to make this customisable - one way could be like this:
state_machine_enum :foo do |sm|
sm.value_map { |enum| enum_sym.to_s.upcase }
end
or similar. Or we need to add a test that the passed mapping overrides the one received from the Collector and there is a check if there is a discrepancy (come to think of it - this might even be better, as the standard Rails way of defining an enum can then be preserved)
The text was updated successfully, but these errors were encountered:
At the moment state_machine_enum relies on Postgres enums. The values for the enum attribute are collected from the collector, but there is no way to map them either to specific integers (
closed: 0, open: 1
) or to strings (closed: "CLOSED", open: "OPEN"
) as they are picked up from theCollector
. At the moment the only mapping we support is from string to itself -closed: "closed", open: "open"}
We need a way to make this customisable - one way could be like this:or similar. Or we need to add a test that the passed mapping overrides the one received from the
Collector
and there is a check if there is a discrepancy (come to think of it - this might even be better, as the standard Rails way of defining an enum can then be preserved)The text was updated successfully, but these errors were encountered: