Skip to content

Need a warning in Readme #235

Closed
Closed
@tranvictor

Description

@tranvictor

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions