Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed update_database for new Migrations versioning scheme

  • Loading branch information...
commit 80ca76c3802a52447330afe9f1241d3baef762c5 1 parent c174cf4
David Ryder authored
Showing with 7 additions and 5 deletions.
  1. +7 −5 app/controllers/admin/settings_controller.rb
View
12 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 added a note

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ 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
Please sign in to comment.
Something went wrong with that request. Please try again.