rails/rails — pull request #12407 by senny (2013-09-30 07:47:15+00:00)
Title: Extract `.next_migration_number` into module for third party generators.

Many third party generators, who need to generate migrations copy the `.next_migration_number` method. This is necessary because most of the time you can't extend `ActiveRecord::Generators::Base` because it's superclass is `Rails::Generators::NamedBase`. Some examples:

* [queue classic](https://github.com/ryandotsmith/queue_classic/blob/master/lib/generators/queue_classic/install_generator.rb#L14-L17)
* [paper trail](https://github.com/airblade/paper_trail/blob/master/lib/generators/paper_trail/install_generator.rb#L19-L21)
* [acts as taggable](https://github.com/mbleigh/acts-as-taggable-on/blob/master/lib/generators/acts_as_taggable_on/migration/migration_generator.rb#L22-L30)

This copying has the negative effect that over time every implementation will be slightly different and falls out of sync.

This PR bundles the necessary functionality for Active Record Migration generators inside a new module `ActiveRecord::Generators::Migration`. This module gets `migration_template` working without any further configuration.