-
Notifications
You must be signed in to change notification settings - Fork 191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Need a warning in Readme #235
Comments
@tranvictor nice catch, thank you for filling the issue! Care to send a pull request please? |
@nashby sure, i will file a PR soon. |
@nashby , @tranvictor , @aki77 , guys, I just have noticed that mongoid already has some method called it actually means that for quite frequent scenario when models have enumerable field called
So I believe we got to have this warning as well. |
Using
enumerize
withMongoid
can mislead to something pretty hard to figure out which iswriter?
method.In more details, if we use
writer
as a valid value for a field andpredicates
istrue
,prefix
isfalse
then developers are likely to usewriter?
to check if the field has value ofwriter
. In fact, this method mostly returnsfalse
because it is defined byMongoid
.Explanation:
Enumerize
delegates thewriter?
message toEnumerize:Value
, this value is inherited from String which is internally extended byMongoid
withwriter?
defined. On the other hand, when developer checkmethod(:writer?)
, they would still see that the method is fromenumerize
that seems legit making it pretty hard to track down.Proposal: We should have a strong warning for developers about this on
Readme
becausewriter
is not a rare value to use. For website dealing with publishing content (news, magazine, ad network, affiliate platform, ...), developers can easily fall into usingwriter
as a role of an user.The text was updated successfully, but these errors were encountered: