With most mentions of JAVA enums on the internet, it is everywhere mentioned that enums should be all uppercase (ex: ACTIVE
).
Like here: Coding Conventions - Naming Enums
But when it comes to Rails, in all there examples and docs they use lowercase enum value (ex: 'active'), like here: http://edgeapi.rubyonrails.org/classes/ActiveRecord/Enum.html
which makes sense since rails also provides instance methods by the name of these enums (eg: obj.active?). Is this the only reason why enums in Rails are used as lowercase, or is there more to it? Also we differ from the convention when we use enums as lowercase, should this be the case? or shall we use uppercase enums in Rails as well?
So for example I have a status
enum in my model, which can either be active, draft or inactive as per convention, should it be:
enum status: {active: 1, draft: 2, inactive: 3}
or:
enum status: {ACTIVE: 1, DRAFT: 2, INACTIVE: 3}
Which one and why?