serialized_attributes已弃用,无需替换

时间:2017-02-21 02:50:04

标签: ruby-on-rails deprecation-warning

当我尝试更新模型时,我收到以下不推荐的警告

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时支持?

1 个答案:

答案 0 :(得分:1)

基于此github issue

看起来将paper_trail升级到较新版本会修复它