Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails 4.2 DEPRECATION WARNING: `serialized_attributes` is deprecated without replacement,

This warning shows up for me (for everyone) in the majority of controller tests. I know its just a warning...for now...until 5 is released. I am unsure what I need to change to comply with this deprecation. What has changed with serialized_attributes? Id like to make this warning go away and improve my code in prep for 5.0...but unsure how to proceed. Thanks.

update

When hitting a standard update action from a controller test...I get the error:

@document.update_attributes(document_params)

in the test (condensed for this example):

    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

This test passes, but now in rails 4.2 puts the error: DEPRECATION WARNING: serialized_attributes is deprecated without replacement, and will be removed in Rails 5.0."

So, in this example...are the serialized_attributes "{ name: 'Passport' }"?

like image 438
hellion Avatar asked Dec 23 '14 04:12

hellion


1 Answers

Are you perhaps using the paper_trail gem? If so, see issue #416 in that project.

like image 161
smathy Avatar answered Oct 03 '22 03:10

smathy