forked from attr-encrypted/attr_encrypted
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't define unnecessary accessors with ActiveRecord Adapter.
Without DB connection, ActiveRecord doesn't define methods for columns and AttrEncrypted define attr_reader and attr_writer for the encrypted columns. As a result, AR model with attr_encrypted column return nil for the target column if the DB connection was lost at the load time. To suppress this behavior, don't define accessors if DB connection was active. Introduce attribute_instance_methods_as_symbols_available? to detect connection failure with AcriveRecord Adapter.
- Loading branch information
Showing
2 changed files
with
20 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters