File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -36,11 +36,12 @@ module FieldTypes
36
36
} . with_indifferent_access . freeze
37
37
38
38
def get ( value )
39
+ value = value . to_sym if value . is_a? ( String )
39
40
mapping [ value ] || handle_unmapped_type ( value )
40
41
end
41
42
42
43
def define ( symbol , klass )
43
- mapping [ symbol ] = klass
44
+ mapping [ symbol . to_sym ] = klass
44
45
end
45
46
46
47
delegate :delete , to : :mapping
@@ -53,7 +54,6 @@ def handle_unmapped_type(type)
53
54
return Object if type . nil?
54
55
55
56
if type . is_a? ( Module )
56
- symbol = type . name . demodulize . underscore
57
57
warn_class_type ( type . name )
58
58
return Mongoid ::Boolean if type . to_s == 'Boolean'
59
59
return type
@@ -64,6 +64,7 @@ def handle_unmapped_type(type)
64
64
65
65
def warn_class_type ( type )
66
66
return if warned_class_types . include? ( type )
67
+ symbol = type . demodulize . underscore
67
68
Mongoid . logger . warn (
68
69
"Using a Class (#{ type } ) in the field :type option is deprecated " +
69
70
"and will be removed in a future major Mongoid version. " +
You can’t perform that action at this time.
0 commit comments