Last active
July 22, 2022 18:16
-
-
Save ankane/35332faacd7ed70d8e51ea5bbb17dfb8 to your computer and use it in GitHub Desktop.
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
require "bundler/inline" | |
gemfile do | |
source "https://rubygems.org" | |
gem "activerecord", require: "active_record" | |
gem "sqlite3" | |
gem "lockbox", git: "https://github.com/ankane/lockbox.git" | |
end | |
puts "Lockbox version: #{Lockbox::VERSION}" | |
Lockbox.master_key = "0"*64 | |
ActiveRecord::Base.establish_connection adapter: "sqlite3", database: ":memory:" | |
ActiveRecord::Schema.define do | |
create_table :users do |t| | |
t.text :email_ciphertext | |
end | |
end | |
class User < ActiveRecord::Base | |
has_encrypted :email | |
end | |
user = User.create!(email: "[email protected]") | |
p user.email |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment