diff options
author | kayvan <kayvan.najafzadeh@gmail.com> | 2014-02-09 10:26:10 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2014-02-11 14:59:51 -0800 |
commit | 2862cd8e11fd76f943c224c12e90bd04c05eadd4 (patch) | |
tree | 070fdb933d9da467e0abf4f96def94b58a923e10 | |
parent | c5034d60dba0cd31a6a8c612ee35d63b8127793a (diff) | |
download | rails-2862cd8e11fd76f943c224c12e90bd04c05eadd4.tar.gz rails-2862cd8e11fd76f943c224c12e90bd04c05eadd4.tar.bz2 rails-2862cd8e11fd76f943c224c12e90bd04c05eadd4.zip |
adding connection parameter to check_pending for migrations
-rw-r--r-- | activerecord/lib/active_record/migration.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb index b57da73969..b510e78460 100644 --- a/activerecord/lib/active_record/migration.rb +++ b/activerecord/lib/active_record/migration.rb @@ -385,8 +385,8 @@ module ActiveRecord attr_accessor :delegate # :nodoc: attr_accessor :disable_ddl_transaction # :nodoc: - def check_pending! - raise ActiveRecord::PendingMigrationError if ActiveRecord::Migrator.needs_migration? + def check_pending!(connection = Base.connection) + raise ActiveRecord::PendingMigrationError if ActiveRecord::Migrator.needs_migration?(connection) end def load_schema_if_pending! @@ -830,7 +830,7 @@ module ActiveRecord SchemaMigration.all.map { |x| x.version.to_i }.sort end - def current_version + def current_version(connection = Base.connection) sm_table = schema_migrations_table_name if Base.connection.table_exists?(sm_table) get_all_versions.max || 0 @@ -839,8 +839,8 @@ module ActiveRecord end end - def needs_migration? - current_version < last_version + def needs_migration?(connection = Base.connection) + current_version(connection) < last_version end def last_version |