-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
-
None
After updating from 3.0.15 to 3.1.0 I am now having validation issues when using Symbol fields. If you set a field to a string value then it gets properly converted to a symbol, however validation_inclusion_of fails.
For example:
class Example
include Mongoid::Document
field :name, type: Symbol
validates_inclusion_of :name, in: [:foo]
end
example = Example.new
- this works
example.name = :foo
example.valid? # => true
- but this fails
example.name = "foo"
example.name == :foo #=> true - string properly gets auto-converted to a symbol
example.valid? #=> false - string version seems to be getting compared on validation