class ActiveRecord::Generators::MlangMigrationGenerator
Public Class Methods
task_clear()
click to toggle source
# 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_create()
click to toggle source
# 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
Public Instance Methods
create_migration_file()
click to toggle source
# 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
Protected Instance Methods
lang_table_name()
click to toggle source
# File lib/generators/active_record/mlang_migration_generator.rb, line 28 def lang_table_name current_table_name = ActiveRecord::Mlang::Lang.table_name if current_table_name == 'lang' || current_table_name == 'langs' current_table_name = ActiveRecord::Base.pluralize_table_names ? 'langs' : 'lang' end current_table_name end
lang_text_table_name()
click to toggle source
# File lib/generators/active_record/mlang_migration_generator.rb, line 36 def lang_text_table_name current_table_name = ActiveRecord::Mlang::LangText.table_name if current_table_name == 'lang_text' || current_table_name == 'lang_texts' current_table_name = ActiveRecord::Base.pluralize_table_names ? 'lang_texts' : 'lang_text' end current_table_name end