-
Type: New Feature
-
Resolution: Fixed
-
Priority: Minor - P4
-
Affects Version/s: None
-
Component/s: None
-
Major Change
Mongoid defines Boolean here:
https://github.com/mongodb/mongoid/blob/621294b9d4f38e2f0a32984bbb415d544bed437c/lib/mongoid/criteria/queryable/extensions.rb#L4
Reasons why this is bad:
1) It is not Ruby-esque. Ruby core team has chosen NOT to define Boolean (see here: https://bugs.ruby-lang.org/issues/12515)
2) It may conflict with gems which define Boolean as a module instead of a class.
3) Internally, Mongoid is already mapping `field :my_bool, type: Boolean` to `Mongoid::Boolean`, which causes surprising behavior in various places (one small example: https://github.com/mongoid/mongoid-rspec/issues/136)
A good solution would be to remove `::Boolean` require users to use `Mongoid::Boolean` everywhere. This will require users to update their API usage in a backward compatible way (Mongoid::Boolean already works on Mongoid 3+) so it's a relatively painless upgrade.