Permalink
Browse files

Fixed update_database for new Migrations versioning scheme

  • Loading branch information...
1 parent c174cf4 commit 80ca76c3802a52447330afe9f1241d3baef762c5 David Ryder committed Oct 29, 2011
Showing with 7 additions and 5 deletions.
  1. +7 −5 app/controllers/admin/settings_controller.rb
@@ -34,11 +34,13 @@ def update
def update_database
@current_version = Migrator.current_schema_version
- @needed_version = Migrator.max_schema_version
- @support = Migrator.db_supports_migrations?
- @needed_migrations = Migrator.available_migrations[@current_version..@needed_version].collect do |mig|
- mig.scan(/\d+\_([\w_]+)\.rb$/).flatten.first.humanize
- end
+
+ path = File.expand_path("db/migrate")
@ook
ook Nov 2, 2011

If I can comment, I recommand to use

Rails.root + 'db' + 'migrate'

instead if File#expand_path

The main advantage is that you get a Pathname instance, which is very convenient.
The other is to stay coherent with Rails usage.

+ migrator = ActiveRecord::Migrator.new(:up, path)
+ if migrator.pending_migrations.size > 0
+ @pending = migrator.pending_migrations.count
+ @needed_migrations = migrator.pending_migrations
+ end
end
def migrate

0 comments on commit 80ca76c

Please sign in to comment.