Skip to content

Instantly share code, notes, and snippets.

@pdbradley
Last active December 23, 2017 19:01
Show Gist options
  • Save pdbradley/6e39162709f1bdd50a001dd1f7a0c22e to your computer and use it in GitHub Desktop.
Save pdbradley/6e39162709f1bdd50a001dd1f7a0c22e to your computer and use it in GitHub Desktop.
getter setter encrypted stuff (weak but good enough)
# 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
@pdbradley
Copy link
Author

line 11 should say encode not decode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment