Sha256: e9e241bbd330b2c0d27238e8a80c06fbef1a16d89e0f8100074c76b3e6ad54ba

Contents?: true

Size: 854 Bytes

Versions: 3

Compression:

Stored size: 854 Bytes

Contents

# these generators are backed by rails' generators
require "rails/generators"
require 'rails/generators/active_record/migration/migration_generator'
module StandaloneMigrationsNew
  class Generator
    def self.migration(name, options="")
      generator_params = [name] + options.split(" ")
      Rails::Generators.invoke "active_record:migration", generator_params,
        :destination_root => Rails.root
    end
  end

  class CacheMigrationGenerator < ActiveRecord::Generators::MigrationGenerator
    source_root File.join(File.dirname(ActiveRecord::Generators::MigrationGenerator.instance_method(:create_migration_file).source_location.first), "templates")

    def create_migration_file
      set_local_assigns!
      validate_file_name!
      migration_template @migration_template, Rails.application.config.paths["db/migrate"]
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
standalone_migrations_new-7.1.2 lib/standalone_migrations_new/generator.rb
standalone_migrations_new-7.1.1 lib/standalone_migrations_new/generator.rb
standalone_migrations_new-7.1.0 lib/standalone_migrations_new/generator.rb