Permalink
Browse files

Replace the buggy next_migration_number implementation with what Acti…

…veRecord::Generators::Base already have
  • Loading branch information...
1 parent 1ecb68e commit c9fb84c32bb46437b6f58da3df2dec7dbed958c1 @thekindofme thekindofme committed Feb 26, 2013
Showing with 5 additions and 6 deletions.
  1. +5 −6 lib/generators/letsrate/letsrate_generator.rb
@@ -1,4 +1,5 @@
require 'rails/generators/migration'
+require 'rails/generators/active_model'
class LetsrateGenerator < Rails::Generators::NamedBase
include Rails::Generators::Migration
@@ -38,12 +39,10 @@ def create_migration
end
- private
+ private
+ # Implement the required interface for Rails::Generators::Migration.
def self.next_migration_number(dirname)
- if ActiveRecord::Base.timestamped_migrations
- Time.now.utc.strftime("%Y%m%d%H%M%S%L")
- else
- "%.3d" % (current_migration_number(dirname) + 1)
- end
+ next_migration_number = current_migration_number(dirname) + 1
+ ActiveRecord::Migration.next_migration_number(next_migration_number)
end
end

0 comments on commit c9fb84c

Please sign in to comment.