Sha256: dc84cd7b24337ee5f6904e3745e1b2e083b36ad42c3544716574a1af9bd3e31f

Contents?: true

Size: 643 Bytes

Versions: 1

Compression:

Stored size: 643 Bytes

Contents

require 'rails/generators'
require 'rails/generators/migration'

module I18n
  module ActiveRecord
    class InstallGenerator < Rails::Generators::Base
      include Rails::Generators::Migration

      def self.next_migration_number(path)
        unless @prev_migration_nr
          @prev_migration_nr = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
        else
          @prev_migration_nr += 1
        end
        @prev_migration_nr.to_s
      end

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

      def copy_migrations
        migration_template "migration.rb", "db/migrate/create_translations.rb"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
i18n-active_record-backend-0.1.0 lib/generators/i18n/active_record/install/install_generator.rb