Skip to content

Nil assignment returning old value when vault_lazy_decrypt! and vault_single_decrypt! #116

@kjakub

Description

@kjakub

After assigning nil to an encrypted attribute, the return value for the attribute is still the previous value.

example of failing test

it "allows dirty attributes to be unset" do
  person = LazySinglePerson.create!(ssn: "123-45-6789")
  person.ssn = nil
  expect(person.ssn).to be_nil
end

result

  1. Vault::Rails lazy single decrypt allows dirty attributes to be unset
    Failure/Error: expect(person.ssn).to be_nil

    expected: nil
    got: "123-45-6789"
    ./spec/integration/rails_spec.rb:327:in `block (3 levels) in <top (required)>'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions