diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2019-04-19 15:38:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-19 15:38:57 +0200 |
commit | 10da0a27512e108a5cde3eeba774b01c15f6c43a (patch) | |
tree | 95f93befe2e9723cade192bc6af06412bf6f6f6f /activerecord/lib/active_record | |
parent | 3c8ea319d0fa4cd1e707a294ce1be4ffc8cd78b9 (diff) | |
parent | feaaa7576a0774471e36dc59730a886f623712e6 (diff) | |
download | rails-10da0a27512e108a5cde3eeba774b01c15f6c43a.tar.gz rails-10da0a27512e108a5cde3eeba774b01c15f6c43a.tar.bz2 rails-10da0a27512e108a5cde3eeba774b01c15f6c43a.zip |
Merge pull request #34788 from gsamokovarov/actionable-errors
Introduce Actionable Errors
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r-- | activerecord/lib/active_record/migration.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/activerecord/lib/active_record/migration.rb b/activerecord/lib/active_record/migration.rb index ed0c6d48b8..f20edbeb93 100644 --- a/activerecord/lib/active_record/migration.rb +++ b/activerecord/lib/active_record/migration.rb @@ -4,6 +4,7 @@ require "benchmark" require "set" require "zlib" require "active_support/core_ext/module/attribute_accessors" +require "active_support/actionable_error" module ActiveRecord class MigrationError < ActiveRecordError #:nodoc: @@ -128,6 +129,12 @@ module ActiveRecord end class PendingMigrationError < MigrationError #:nodoc: + include ActiveSupport::ActionableError + + action "Run pending migrations" do + ActiveRecord::Tasks::DatabaseTasks.migrate + end + def initialize(message = nil) if !message && defined?(Rails.env) super("Migrations are pending. To resolve this issue, run:\n\n rails db:migrate RAILS_ENV=#{::Rails.env}") |