Last active
December 23, 2017 19:01
-
-
Save pdbradley/6e39162709f1bdd50a001dd1f7a0c22e to your computer and use it in GitHub Desktop.
getter setter encrypted stuff (weak but good enough)
This file contains hidden or 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
# assuming a column called encrypted password, and you need to | |
# get access to the plaintext to do work, put these getters | |
# and setters in your class to magically get what you need | |
def password | |
Base64.decode64(self.encrypted_password) | |
end | |
def password=(string) | |
self.encrypted_password = Base64.decode64(string) | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
line 11 should say encode not decode