Class: ForgetThat::Generators::InstallGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- ForgetThat::Generators::InstallGenerator
- Includes:
- ActiveRecord::Generators::Migration
- Defined in:
- lib/generators/forget_that/install_generator.rb
Instance Method Summary collapse
Instance Method Details
#copy_migration ⇒ Object
11 12 13 |
# File 'lib/generators/forget_that/install_generator.rb', line 11 def copy_migration migration_template 'migration.rb', 'db/migrate/install_forget_that.rb', migration_version: migration_version end |
#migration_version ⇒ Object
15 16 17 |
# File 'lib/generators/forget_that/install_generator.rb', line 15 def migration_version "[#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}]" end |
#used_tables ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/generators/forget_that/install_generator.rb', line 19 def used_tables YAML .load_file('config/anonymization_config.yml') .dig('schema') .keys .map { |table| [table, ActiveRecord::Base.connection.columns(table).map(&:name).include?('anonymized')] } .to_h .reject { |_key, value| value } .keys end |