Sha256: 4358f161b4a01f7838fcb8283b03798ccddd6375e243a96e91e1e1aa7ce3560d
Contents?: true
Size: 774 Bytes
Versions: 58
Compression:
Stored size: 774 Bytes
Contents
require 'rails/generators/migration' module DirtyHistory class MigrationGenerator < Rails::Generators::Base include Rails::Generators::Migration desc "Generates migration for DirtyHistoryRecord model" def self.orm Rails::Generators.options[:rails][:orm] end def self.source_root File.join(File.dirname(__FILE__), 'templates', (orm.to_s unless orm.class.eql?(String)) ) end def self.orm_has_migration? [:active_record].include? orm end def self.next_migration_number(path) Time.now.utc.strftime("%Y%m%d%H%M%S") end def create_migration_file if self.class.orm_has_migration? migration_template 'migration.rb', 'db/migrate/create_dirty_history_records' end end end end
Version data entries
58 entries across 31 versions & 1 rubygems