Sha256: 3ff4275c83206f4b66864594d9cd0a46b31546c0d0a48f3d7340e209f63a48df

Contents?: true

Size: 810 Bytes

Versions: 2

Compression:

Stored size: 810 Bytes

Contents

require "generators/micro_service/server/server_generator"
require "generators/micro_service/server/next_migration_version"
require "rails/generators/migration"
require "rails/generators/active_record"

# Extend the HasDynamicColumnsGenerator so that it creates an AR migration
module MicroService
	class Server < ::ActiveRecord::Base
		class ActiveRecordGenerator < ::MicroService::Server::Generator
			include Rails::Generators::Migration
			extend NextMigrationVersion

			source_paths << File.join(File.dirname(__FILE__), "templates")

			def create_migration_file
				migration_template "migration_0.0.1.rb", "db/migrate/add_micro_service_server_0_0_1_migration.rb"
			end

			def self.next_migration_number(dirname)
				::ActiveRecord::Generators::Base.next_migration_number dirname
			end
		end
	end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
micro_service-server-0.0.3 lib/generators/micro_service/server/active_record_generator.rb
micro_service-server-0.0.2 lib/generators/micro_service/server/active_record_generator.rb