-
Type: Improvement
-
Resolution: Duplicate
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
It's generally bad practice to put constants in configs, for example to prevent load-order errors.
The field parameter type should allow a symbol arg and deprecate usage of constants for Mongoid 8.0.
field :first_name, type: :string # new format field :last_name, type: String # deprecated
There are some gems that use custom types, one that comes to mind is Mongoid::EncryptedString. We should provide an API to register new symbol values as aliases to those types, e.g.:
Mongoid.register_type :encrypted_string, Mongoid::EncryptedString
As long as the class defines `mongoize` and `demongoize` it should work.
- duplicates
-
MONGOID-5210 Prefer symbol field types over class ones
- Closed
- related to
-
MONGOID-5336 Allow user-defined symbol/string field types
- Backlog