ankane / lockbox

Modern encryption for Ruby and Rails
MIT License
1.44k stars 68 forks source link

attr_encrypted —> lockbox with custom attribute name #93

Closed brentdodell closed 3 years ago

brentdodell commented 3 years ago

Hi,

I had a question about migrating a field from attr_encrypted to lockbox, but wasn’t sure the best place to ask it.

We have a field that is defined as such: attr_encrypted :unencrypted_request_xml, :attribute => "request_xml"

The database column is named request_xml.

When migrating to lockbox, I would like the new attribute name to be request_xml and the column name to be request_xml_ciphertext.

If there’s a way to do this with lockbox, I haven’t found it. I’ve created the request_xml_ciphertext column and have tried the following for defining the attribute:

Any suggestions on how to make this work?

ankane commented 3 years ago

Hey @brentdodell, the 2nd one looks right. What behavior or error message are you seeing?