I have an application to reproduce this issue over here: https://github.com/radar/mong
I have an older legacy application which I'm trying to upgrade to Rails 5 & Mongoid 6.2.0. We have a model called "Survey" which has a field called "options". Mongoid seems to choke on this, saying:
{{/Users/ryanbigg/.gem/ruby/2.3.1/gems/mongoid-6.2.0/lib/mongoid/errors/invalid_field.rb:44:in `instance_method': undefined method `options' for class `Survey' (NameError)
from /Users/ryanbigg/.gem/ruby/2.3.1/gems/mongoid-6.2.0/lib/mongoid/errors/invalid_field.rb:44:in `origin'
from /Users/ryanbigg/.gem/ruby/2.3.1/gems/mongoid-6.2.0/lib/mongoid/errors/invalid_field.rb:22:in `initialize'
from /Users/ryanbigg/.gem/ruby/2.3.1/gems/mongoid-6.2.0/lib/mongoid/fields/validators/macro.rb:75:in `new'}}
I tracked the error back to https://github.com/mongodb/mongoid/blob/master/lib/mongoid/fields/validators/macro.rb#L75 and that's what let me know what the "real" exception is here.
I think an exception should be raised something along the lines of "options is an invalid field because <x, y, z>" rather than this weird exception.
Thank you for your time!
- related to
-
MONGOID-4444 Field names display and options are on prohibited_methods list
- Closed