2

我最近将一个应用程序从 Rails 3.0.10 更新到 Rails 3.2.8,我们开始在我们的规范中收到此弃用警告:

弃用警告:您正在尝试创建属性profissional'. Writing arbitrary attributes on a model is deprecated. Please just useattr_writer` 等(从 .../spec/models/agendamento/agendamento_spec.rb:109 中的块(3 级)调用)

有问题的行是:Agendamento::Agenda.new(descricao: 'Agenda', profissional: profissional, situacao: :ativa)。Agenda 与profissional 有belongs_to 关联。

两个数据库在上次迁移时都是最新的,因此其他类似问题的答案并不能解决我的问题。

这真的会被弃用,并且预计不会在未来版本的 Rails 上工作,还是我错过了什么?

4

0 回答 0