Class: ActiveRecord::Migration
- Inherits:
-
Object
- Object
- ActiveRecord::Migration
- Defined in:
- lib/encryption_migrator.rb
Instance Method Summary collapse
Instance Method Details
#unencrypt_field(model, column, key:) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/encryption_migrator.rb', line 27 def unencrypt_field(model, column, key:) const = EncryptionMigrator.constant_for(model) encrypted_sym = :"encrypted_#{column}" add_column model, column, :string const.reset_column_information const.all.each do |row| EncryptionMigrator.decrypt_and_update_row(row, const, column, key) end remove_column model, encrypted_sym end |