Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixes rake tasks in production mode.

lib/bare_migration.rb was not loaded anymore, which was breaking some migrations.
Contrary to running your application in production, a Rake task does not eager load your entire code base. So only if  is false, will the application be eager-loaded in production. And  is set to true in the :environment Rake task.

Solution was given at https://rails.lighthouseapp.com/projects/8994/tickets/2506-models-are-not-loaded-in-migrations-when-configthreadsafe-is-set
  • Loading branch information...
commit a57a915ea994e1c0e3a4b523dd5d12453e4d012c 1 parent fdf6bc6
@fdv fdv authored
Showing with 3 additions and 1 deletion.
  1. +1 −0  config/application.rb
  2. +2 −1  config/environments/production.rb
View
1  config/application.rb
@@ -55,6 +55,7 @@ class Application < Rails::Application
require 'typo_guid'
## Required by the plugins themselves.
# require 'typo_plugins'
+ require 'bare_migration'
require 'typo_version'
require 'rails_patch/active_support'
View
3  config/environments/production.rb
@@ -26,6 +26,7 @@
# Enable threaded mode
config.threadsafe!
-
+ config.dependency_loading = true if $rails_rake_task
+
Migrator.offer_migration_when_available = true
end
Please sign in to comment.
Something went wrong with that request. Please try again.