Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only include instance methods once attr_encrypted is specified #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

nightpool
Copy link
Member

Use the "InstanceMethods" module pattern to isolate the instance methods for attr_encrypted so that they don't infect other ActiveRecord models in the codebase. This resolves some compatibility issues with other libraries that override method_missing

Copy link
Member Author

@nightpool nightpool left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we're already in the class context so if we go to the eigenclass then we'd be looking at class methods, not instance methods.

@nightpool
Copy link
Member Author

nightpool commented Jul 22, 2022

I also don't understand why singleton_class.class_eval worked in development, but not when cache_classes was enabled. some sort of weird load order bullshit

@nightpool
Copy link
Member Author

Tests on the main-repo PR here: attr-encrypted#407

Tests fail on Rails 5+ due to https://gist.github.com/nightpool/14438c6765896054ea3a3eb1c66b1826. Tests fail on Rails 3-4 due to seemingly unrelated dependency/gem problems.

Use the "InstanceMethods" module pattern to isolate the instance methods for attr_encrypted so that they don't infect other ActiveRecord models in the codebase. This resolves some compatibility issues with other libraries that override method_missing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant