diff options
author | schneems <richard.schneeman@gmail.com> | 2012-06-05 19:15:16 -0500 |
---|---|---|
committer | schneems <richard.schneeman@gmail.com> | 2012-06-09 13:30:23 -0500 |
commit | 96f19f6cf62fb4705a75cf4a81e4e2f145a4cee2 (patch) | |
tree | af7122bcb460a3412d3a034b7efb8d45aa9b51dd /railties/lib | |
parent | e5b39862cb4f8f3097cc8ab2dc606ddb1bd1febb (diff) | |
download | rails-96f19f6cf62fb4705a75cf4a81e4e2f145a4cee2.tar.gz rails-96f19f6cf62fb4705a75cf4a81e4e2f145a4cee2.tar.bz2 rails-96f19f6cf62fb4705a75cf4a81e4e2f145a4cee2.zip |
raise error for pending migration
can be configured by setting config.active_record.migration. Setting to :page_load will raise an error on each page refresh if there are migrations that are pending. Setting to :page_load is defaulted in development for new applications.
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt | 3 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/test/test_helper.rb | 2 |
2 files changed, 5 insertions, 0 deletions
diff --git a/railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt b/railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt index 24bcec854c..01f9396403 100644 --- a/railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +++ b/railties/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt @@ -26,6 +26,9 @@ # Log the query plan for queries taking more than this (works # with SQLite, MySQL, and PostgreSQL). config.active_record.auto_explain_threshold_in_seconds = 0.5 + + # Raise an error on page load if there are pending migrations + config.active_record.migration_error = :page_load <%- end -%> <%- unless options.skip_sprockets? -%> diff --git a/railties/lib/rails/generators/rails/app/templates/test/test_helper.rb b/railties/lib/rails/generators/rails/app/templates/test/test_helper.rb index a8f7aeac7d..0090293200 100644 --- a/railties/lib/rails/generators/rails/app/templates/test/test_helper.rb +++ b/railties/lib/rails/generators/rails/app/templates/test/test_helper.rb @@ -4,6 +4,8 @@ require 'rails/test_help' class ActiveSupport::TestCase <% unless options[:skip_active_record] -%> + ActiveRecord::Migration.check_pending! + # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order. # # Note: You'll currently still have to declare fixtures explicitly in integration tests |