Sha256: cdbbacd904adbb12238152c1b6a0d5096a1181f1967fd30fbf3f94a7e74a0e9a

Contents?: true

Size: 772 Bytes

Versions: 3

Compression:

Stored size: 772 Bytes

Contents

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

class AuditedMigrationGenerator < Rails::Generators::Base
  include Rails::Generators::Migration

  def self.source_root
    File.join(File.dirname(__FILE__), 'templates')
  end

  # Implement the required interface for Rails::Generators::Migration.
  # taken from http://github.com/rails/rails/blob/master/activerecord/lib/generators/active_record.rb
  def self.next_migration_number(dirname) #:nodoc:
    if ActiveRecord::Base.timestamped_migrations
      Time.now.utc.strftime("%Y%m%d%H%M%S")
    else
      "%.3d" % (current_migration_number(dirname) + 1)
    end
  end
  
  def create_acts_as_audited_migration
    migration_template 'migration.rb', 'db/migrate/acts_as_audited_migration.rb'
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
acts_as_audited_rails3-1.1.2 lib/generators/audited_migration/audited_migration_generator.rb
acts_as_audited_rails3-1.1.1.5 lib/generators/audited_migration/audited_migration_generator.rb
acts_as_audited_rails3-1.1.1.4 lib/generators/audited_migration/audited_migration_generator.rb