在大多数控制器测试中,我(以及其他人)都会收到这个警告。我知道现在只是一个警告……直到5发布为止。我不确定我需要改变什么来遵守这个弃用。serialized_attributes有什么变化吗?我想让这个警告消失并改进我的代码以为5.0做好准备……但是不确定该如何继续。谢谢。
更新
当从控制器测试中触发标准的更新操作时,我收到以下错误:
@document.update_attributes(document_params)
测试中(为了这个例子而压缩):
before do
@document = documents(:drivers_license)
end
def valid_params
{ name: 'Passport' }
end
it "must update document" do
put :update, id: @document, document: valid_params
assert_redirected_to documents_path
end
这个测试通过了,但是在Rails 4.2中会出现以下错误提示:DEPRECATION WARNING: serialized_attributes
被弃用且没有替代品,将在Rails 5.0中被移除。
所以,在这个例子中...serialized_attributes指的是"{ name: 'Passport' }"吗?