class TheModerator::InstallGenerator < Rails::Generators::Base
  include Rails::Generators::Migration

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

  def copy_model
    template 'moderation.rb', File.join('app', 'models', 'moderation.rb')
  end

  def create_migration
    migration_template 'migration.rb', 'db/migrate/create_moderations.rb'
  end

  def self.next_migration_number(dirname)
    ActiveRecord::Migration.next_migration_number(
      current_migration_number(dirname) + 1)
  end
end

class TheModerator::InstallGenerator < Rails::Generators::Base
  include Rails::Generators::Migration

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

  def copy_model
    template 'moderation.rb', File.join('app', 'models', 'moderation.rb')
  end

  def create_migration_file
    migration_template 'migration.rb', 'db/migrate/create_moderations.rb'
  end

  def self.next_migration_number(dirname)
    ActiveRecord::Migration.next_migration_number(
      current_migration_number(dirname) + 1)
  end
end

Rename create_migration method in generator for Rails 4
Rename create_migration method in generator for Rails 4

Rails 4 already has a create_migration method in
Rails::Generators::Migration.
