0

I have an existing project that I am now trying to update to use the attr-encrypted gem to encrypt some of my existing table columns.

Everything works as expected IF I update the names of the table attributes that I want encrypted to start with 'encrypted_'.

However, I am trying to avoid modifying my tables at all. Is that possible using attr-encrypted? And if so, how would I reference the encrypted/decrypted versions of the column data?

So for example, I have a Users table with a phone_number attribute. I want to encrypt the phone_number data without having to rename it to encrypted_phone_number in order for the attr_encrypted gem to work.

Thanks,

4

1 回答 1

0

我认为这是不可能的,因为attr-encryptedgem 需要区分这些字段(加密前与加密后),并且它会尝试active_record挂钩以加密字段。

于 2016-03-09T22:27:12.477 回答