The Rails 4 enum implementation is rather nice for making a status field such as
class User < ActiveRecord::Base
enum status: [:goodstanding, :outstanding]
But if I want to display text depending on the status, this text mapping should be in one place and the enum doesn't offer a solution to map to text.
Here is what I had before
class User < ActiveRecord::Base
STATUS = {
:outstanding => "Outstanding balance",
:goodstanding => "In good standing"
}
Which allowed me to do
User::STATUS[user.status] # "In good standing"
to display my text. Any suggestions on how to do this with the newer enum type?