You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you have been working with Ruby for a while, you would probably be familiar with attr_accessor, attr_reader and attr_writer which provide you with getter and/or setter. These methods are mostly convenient, but if you are required to store sensitive information in the database (i.e. OAuth token), then you will need your own custom getter and setter to protect the sensitive data.
You can make use of the #encrypt_and_sign and #decrypt_and_verify methods available in Rails to encrypt and decrypt data in your custom getter and setter, and here's how you can do it:
Activity