Leveraging ActiveRecord::Generators::Base class for implementation of the :next_migration_number class method on the InstallGenerator

This commit is contained in:
Ben Atkins 2013-08-19 12:02:11 -04:00
parent aa6fbedc9e
commit ccf06da461
1 changed files with 2 additions and 2 deletions

View File

@ -1,5 +1,6 @@
require 'rails/generators' require 'rails/generators'
require 'rails/generators/migration' require 'rails/generators/migration'
require 'rails/generators/active_record'
module PaperTrail module PaperTrail
class InstallGenerator < ::Rails::Generators::Base class InstallGenerator < ::Rails::Generators::Base
@ -16,8 +17,7 @@ module PaperTrail
end end
def self.next_migration_number(dirname) def self.next_migration_number(dirname)
next_migration_number = current_migration_number(dirname) + 1 ActiveRecord::Generators::Base.next_migration_number(dirname)
ActiveRecord::Migration.next_migration_number(next_migration_number)
end end
end end
end end