Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Replace the buggy next_migration_number implementation with what ActiveR... #19

Merged
merged 2 commits into from

2 participants

@thekindofme

...ecord::Generators::Base already have.

The current implementation of next_migration_number generates VERSION numbers that are too long. This results in these migrations been run last every time even if other migrations are created after these. Resulting in issues like : #14

So just use what ActiveRecord::Generators::Base already have implemented.

https://github.com/rails/rails/blob/master/activerecord/lib/rails/generators/active_record.rb#L19

@muratguzel muratguzel merged commit f7a0b08 into muratguzel:master
@muratguzel
Owner

thanks for your commit ...

@wazery wazery referenced this pull request in wazery/ratyrate
Open

Rake rollback and redo broken #5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Feb 26, 2013
  1. @thekindofme

    Replace the buggy next_migration_number implementation with what Acti…

    thekindofme authored
    …veRecord::Generators::Base already have
  2. @thekindofme
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 11 deletions.
  1. +2 −11 lib/generators/letsrate/letsrate_generator.rb
View
13 lib/generators/letsrate/letsrate_generator.rb
@@ -1,5 +1,6 @@
require 'rails/generators/migration'
-class LetsrateGenerator < Rails::Generators::NamedBase
+require 'rails/generators/active_record'
+class LetsrateGenerator < ActiveRecord::Generators::Base
include Rails::Generators::Migration
source_root File.expand_path('../templates', __FILE__)
@@ -35,15 +36,5 @@ def create_cacheable_migration
desc "migration is creating ..."
def create_migration
migration_template "migration.rb", "db/migrate/create_rates.rb"
- end
-
-
- private
- 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
end
end
Something went wrong with that request. Please try again.