class Rahasia::Generators::MigrationGenerator

Extend Rails Model Generator

Public Instance Methods

copy_migration() click to toggle source
# File lib/generators/rahasia/migration_generator.rb, line 18
def copy_migration
  suffix = attributes_names.join('_').first(13).to_s.presence || 'encrypt'
  migration_template \
    'migration.rb.tt',
    "db/migrate/rahasia_#{table_name}#{suffix}.rb",
    migration_version: migration_version
end
migration_version() click to toggle source
# File lib/generators/rahasia/migration_generator.rb, line 26
def migration_version
  return if ActiveRecord::VERSION::MAJOR == 4

  "[#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}]"
end