Class: ActiveRecord::Generators::MlangMigrationGenerator

Inherits:
Base
  • Object
show all
Defined in:
lib/generators/active_record/mlang_migration_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.task_clearObject



17
18
19
20
# File 'lib/generators/active_record/mlang_migration_generator.rb', line 17

def self.task_clear
  ActiveRecord::Base.connection.execute "DELETE FROM #{ActiveRecord::Mlang::Lang.table_name};"
  ActiveRecord::Base.connection.execute "DELETE FROM #{ActiveRecord::Mlang::LangText.table_name};"
end

.task_createObject



11
12
13
14
15
# File 'lib/generators/active_record/mlang_migration_generator.rb', line 11

def self.task_create
  raise 'Task unavailable to this database (no migration support)' unless ActiveRecord::Base.connection.supports_migrations?
  Rails.application.load_generators if Rails.application
  ActiveRecord::Generators::MlangMigrationGenerator.start [ ENV['MIGRATION'] || 'create_langs_table' ]
end

Instance Method Details

#create_migration_fileObject



22
23
24
# File 'lib/generators/active_record/mlang_migration_generator.rb', line 22

def create_migration_file
  migration_template "migration.rb", "db/migrate/#{file_name}.rb"
end