当我尝试更新模型时,我收到以下不推荐的警告
DEPRECATION WARNING: `serialized_attributes` is deprecated without replacement, and will be removed in Rails 5.0.
这是我的控制器示例方法
def update
@test = Test.unscoped.find(params[:id])
@test.name = params[:test][:name]
@test.abbreviation = params[:test][:abbreviation]
if @test.save
redirect_to action: :index
else
@test.errors.delete(:cover_image_content_type)
flash[:error] = @test.errors.messages.to_yaml
redirect_to action: :show
end
端
注意:我的测试模型中还有has_paper_trail版本:: paper_trail_version。如何修复此升级,这将在我升级到Rails 5时支持?