-
Notifications
You must be signed in to change notification settings - Fork 200
Description
Using enumerize with Mongoid can mislead to something pretty hard to figure out which is writer? method.
In more details, if we use writer as a valid value for a field and predicates is true, prefix is false then developers are likely to use writer? to check if the field has value of writer. In fact, this method mostly returns false because it is defined by Mongoid.
Explanation: Enumerize delegates the writer? message to Enumerize:Value, this value is inherited from String which is internally extended by Mongoid with writer? defined. On the other hand, when developer check method(:writer?), they would still see that the method is from enumerize that seems legit making it pretty hard to track down.
Proposal: We should have a strong warning for developers about this on Readme because writer is not a rare value to use. For website dealing with publishing content (news, magazine, ad network, affiliate platform, ...), developers can easily fall into using writer as a role of an user.