Skip to content

Commit a57a915

Browse files
author
Frédéric de Villamil
committed
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
1 parent fdf6bc6 commit a57a915

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

config/application.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ class Application < Rails::Application
5555
require 'typo_guid'
5656
## Required by the plugins themselves.
5757
# require 'typo_plugins'
58+
require 'bare_migration'
5859
require 'typo_version'
5960
require 'rails_patch/active_support'
6061

config/environments/production.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
# Enable threaded mode
2828
config.threadsafe!
29-
29+
config.dependency_loading = true if $rails_rake_task
30+
3031
Migrator.offer_migration_when_available = true
3132
end

0 commit comments

Comments
 (0)