I've got Rails 5 app where I'm using enum for status
column in User
table like below:
class User < ApplicationRecord
enum status: {
approved: 'approved',
in_review: 'in review'
}
end
When user have in_review
status it shows me this:
2.4.5 :029 > User.first.status
=> "in_review"
Which allows me to do:
2.4.5 :031 > User.first.in_review?
=> true
Is there any way to display User.first.status
as in review
without underscore and in addition without losing enum function to get below result?
2.4.5 :029 > User.first.status
=> "in review"
2.4.5 :031 > User.first.in_review?
=> true
I know I could change the model to:
class User < ApplicationRecord
enum status: {
approved: 'approved',
'in_review': 'in review'
}
end
But then User.first.in_review?
won't work.