-
Type: New Feature
-
Resolution: Unresolved
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
Currently the field type protocol is implemented on the value classes themselves. This is problematic because it requires modification of standard library classes by Mongoid and it may require modification of third-party classes by applications (if an application wants to store values of a class defined by a library).
Instead of being implemented on the value classes, the field type protocol can be moved to dedicated classes. For example, we would define a new class, Mongoid::Fields::FieldTypes::Integer, which would implement the 4 required methods (typecast, mongoize, demongoize, evolve) for converting ::Integer values.
This ticket is similar to https://jira.mongodb.org/browse/MONGOID-5210 but focuses on actual implementation of type conversions, whereas https://jira.mongodb.org/browse/MONGOID-5210 changed the API while still keeping the logic on user classes.
- is related to
-
MONGOID-5210 Prefer symbol field types over class ones
- Closed
-
MONGOID-5407 Add phantom custom field type example
- Closed