Closed d4rk5eed closed 9 years ago
Asking the same question! Btw... I think that enum options should be strings (e.g. enum status: ["pending", "ready"] ). +1
+1
+1
To be honest - I can't 100% remember my motivations for doing this. If I had to guess - it was probably to indicate that the field shouldn't be directly access, except through the getters and setters - following on from a few other (similar) gems that do similar things.
@xpepermint What are your thoughts on strings vs. symbols? I felt like symbols would be a better choice here, given that the values are immutable, but curious to hear why you feel these should be strings.
@thetron Huh, I don't remember exactly why but I think I was looking at rails enum
function which works on strings.
There's 5+ forks only to remove the underscore. +1 for me hehe.
Thanks everyone again for your feedback here. I've merged in #12, which added a configuration option to customise the prefix. At some point in the future we might switch the default to be an empty string, but I wanted to make it easy for existing and future users to continue using the gem on the path to v1.0.0, and support for mongoid 5.
:cake:
What is the reason for using underscore in fieldname?
Actually we get another attribute that differ one we created