Search code examples
ruby-on-railsrubyunit-testingattr-encrypted

Rails test throwing Deprecation Warning over attr_encrypted


Rails test is throwing a deprecation warning over a gem (attr_encrypted) which is already updated to the latest version. It reads:

DEPRECATION WARNING: <custom_attribute_name> is not an attribute known to Active Record. This behavior is deprecated and will be removed in the next version of Rails. If you'd like <custom_attribute_name> to be managed by Active Record, add attribute :<custom_attribute_name> to your class.

Not sure what it is asking me to do... it must be declared using attr_encrypted.


Solution

  • The deprecation warning is something the attr_encrypted gem needs to fix, but it seems there is a workaround by adding the attribute call as mentioned in the warning.

    See https://github.com/attr-encrypted/attr_encrypted/issues/260