Sha256: a4aa2236ea4b12f65ada7056a3db05faa172d7e97d7745c5a3b8d00f09e2f4ce

Contents?: true

Size: 555 Bytes

Versions: 2

Compression:

Stored size: 555 Bytes

Contents

require 'rails/generators'

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

  source_root File.expand_path('../templates', __FILE__)
  
  def create_model
    @model = Object.const_get(class_name)
    template 'model.rb.erb', "app/models/#{file_name}_translation.rb"
  end
  
  def create_migration
    migration_template 'migration.rb.erb', "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

2 entries across 2 versions & 1 rubygems

Version Path
translatable_records-1.0.7 lib/generators/translation_generator.rb
translatable_records-1.0.6 lib/generators/translation_generator.rb