123456789_123456789_123456789_123456789_123456789_

Exception: ActiveRecord::PendingMigrationError

Do not use. This class is for internal use only.
Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, MigrationError, ActiveRecordError, StandardError
Instance Chain:
Inherits: ActiveRecord::MigrationError
Defined in: activerecord/lib/active_record/migration.rb

::ActiveSupport::ActionableError - Attributes & Methods

Class Method Summary

Instance Method Summary

Constructor Details

.new(message = nil, pending_migrations: nil) ⇒ PendingMigrationError

[ GitHub ]

  
# File 'activerecord/lib/active_record/migration.rb', line 146

def initialize(message = nil, pending_migrations: nil)
  if pending_migrations.nil?
    connection = ActiveRecord::Tasks::DatabaseTasks.migration_connection
    pending_migrations = connection.migration_context.open.pending_migrations
  end

  super(message || detailed_migration_message(pending_migrations))
end

Class Attribute Details

._actions (rw)

[ GitHub ]

  
# File 'activesupport/lib/active_support/actionable_error.rb', line 17

class_attribute :_actions, default: {}

._actions?Boolean (rw)

[ GitHub ]

  
# File 'activesupport/lib/active_support/actionable_error.rb', line 17

class_attribute :_actions, default: {}

Instance Attribute Details

#_actions (rw)

[ GitHub ]

  
# File 'activesupport/lib/active_support/actionable_error.rb', line 17

class_attribute :_actions, default: {}

#_actions?Boolean (rw)

[ GitHub ]

  
# File 'activesupport/lib/active_support/actionable_error.rb', line 17

class_attribute :_actions, default: {}

Instance Method Details

#connection (private)

[ GitHub ]

  
# File 'activerecord/lib/active_record/migration.rb', line 170

def connection
  ActiveRecord::Tasks::DatabaseTasks.migration_connection
end

#detailed_migration_message(pending_migrations) (private)

[ GitHub ]

  
# File 'activerecord/lib/active_record/migration.rb', line 156

def detailed_migration_message(pending_migrations)
  message = "Migrations are pending. To resolve this issue, run:\n\n        bin/rails db:migrate"
  message += " RAILS_ENV=#{::Rails.env}" if defined?(Rails.env) && !Rails.env.local?
  message += "\n\n"

  message += "You have #{pending_migrations.size} pending #{pending_migrations.size > 1 ? 'migrations:' : 'migration:'}\n\n"

  pending_migrations.each do |pending_migration|
    message += "#{pending_migration.filename}\n"
  end

  message
end