Sha256: edc0b5161acb7710fda648701c5d36d941ae79831e8cac98737f5199a826242f

Contents?: true

Size: 561 Bytes

Versions: 4

Compression:

Stored size: 561 Bytes

Contents

require 'rails/generators'

class TranslationGenerator < Rails::Generators::NamedBase
  include Rails::Generators::Migration

  source_root File.expand_path('../templates', __FILE__)

  def create_translation_model
    @model = Object.const_get(class_name)
    template 'model.rb', "app/models/#{file_name}_translation.rb"
  end

  def create_translation_migration
    migration_template 'migration.rb', "db/migrate/create_#{singular_table_name}_translations.rb"
  end

  def self.next_migration_number(path)
    Time.now.utc.strftime '%Y%m%d%H%M%S'
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
translatable_records-1.1.7 lib/generators/translation_generator.rb
translatable_records-1.1.6 lib/generators/translation_generator.rb
translatable_records-1.1.4 lib/generators/translation_generator.rb
translatable_records-1.1.2 lib/generators/translation_generator.rb