What is the best way to get enum string name from integer value
Here's a solution that removes the magic number.
Order.states.key(Order.states[:cancelled]) => 'cancelled'
Order.states.key(100) => 'cancelled'
Here's a solution that removes the magic number.
Order.states.key(Order.states[:cancelled]) => 'cancelled'
Order.states.key(100) => 'cancelled'