Created
September 2, 2016 14:30
-
-
Save mzaragoza/33fe2db30682071566325c72215efdcd to your computer and use it in GitHub Desktop.
Best way to store bank account information of users?
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
#file name and path app/models/user.rb | |
class User | |
attr_encrypted :bank_account_number, key: ENV['salt'] | |
end |
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
#file name and path config/application.rb | |
require File.expand_path('../boot', __FILE__) | |
require 'rails/all' | |
Bundler.require(*Rails.groups) | |
module ProjectName | |
class Application < Rails::Application | |
config.active_record.raise_in_transactional_callbacks = true | |
config.before_initialize do | |
dev = File.join(Rails.root, 'config', 'config.yml') | |
YAML.load(File.open(dev)).each do |key,value| | |
ENV[key.to_s] = value | |
end if File.exists?(dev) | |
end | |
end | |
end |
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
#file name and path config/config.yml | |
# var section | |
salt: 'This is a key that is 256 bits!!' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment