В настоящее время у меня есть идентификатор столбца, имя, адрес электронной почты, код компании, компания, с которой связались, рекрутер, студент, и я хочу добавить новый с именем респондент.Я только нахожу ответы о том, как добавить новые столбцы ко всем существующим экземплярам в моей базе данных.Итак, я попробовал это:
db.people.update({}, {$set: {"responded": false}}, false, true)
Все мои существующие экземпляры имеют поле: по умолчанию установлено значение false.Когда я пытаюсь добавить нового человека сейчас, я получаю эту ошибку:
Mongoid::Errors::UnknownAttribute in PeopleController#create
message: Attempted to set a value for 'responded' which is not allowed on the model Person. summary: Without including Mongoid::Attributes::Dynamic in your model and the attribute does not already exist in the attributes hash, attempting to call Person#responded= for it is not allowed. This is also triggered by passing the attribute to any method that accepts an attributes hash, and is raised instead of getting a NoMethodError. resolution: You can include Mongoid::Attributes::Dynamic if you expect to be writing values for undefined fields often.