Skip to content

Remove un-necessary monkey-patching of attr_encrypted

Thong Kuah requested to merge remove_attr_encrypted_monkey_patch into master

What does this MR do and why?

  1. This monkey patching causes database connections to be opened while loading config/routes
    1. This patch was added in gitlab-foss!667 (merged), and since fixed upstream in https://github.com/attr-encrypted/attr_encrypted/pull/160.
    2. The implementation of attribute_instance_methods_as_symbols was later changed to use connected? method which is even better because it means we don't open a database connection during routes (see #359913 (closed))
  2. Furthermore, we now effectively stop using attribute_instance_methods_as_symbols, by patching out attribute_instance_methods_as_symbols_available? to always false. See https://github.com/attr-encrypted/attr_encrypted/blob/3.1.0/lib/attr_encrypted.rb#L145-L158

So we simply don't need this monkey-patch

Also adds a raise if we attempt to upgrade attr_encrypted past 3.1.0.

Related issue: #359913 (closed)

Screenshots or screen recordings

These are strongly recommended to assist reviewers and reduce the time to merge your change.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Thong Kuah

Merge request reports