How To Encrypt Fields in Ruby on Rails with Lockbox

Опубликовано: 10 Август 2026
на канале: Mike Rogers
1,894
45

In this tutorial I'm going to show you how to use the Lockbox gem ( https://github.com/ankane/lockbox ) to encrypt field within your Database.

This is a good solution for when you need to store some sensitive data (such an oauth credentials, or an API key) within your database.

Chapters

0:00 - What are we going to do?
0:17 - Why Encrypt Fields
0:57 - attr_encrypted is unmaintained
1:05 - Lockbox is better
1:31 - Adding the Gem to our Gemfile
1:51 - Generating the key
3:00 - Adding migration for field
4:06 - Accessing field via rails console
5:18 - Lockbox is awesome, thank you for watching!

Follow Me Online

➡ Blog: https://mikerogers.io/
➡ Twitter:   / mikerogers0  
➡ GitHub: https://github.com/mikerogers0
➡ YouTube:    / mikerogers0  
➡ BuyMeACoffee: https://www.buymeacoffee.com/MikeRogers0
➡ Dev.to: https://dev.to/mikerogers0

#RubyOnRails #AwesomeRubyGems