From a28940562350992df54f6e6c6909958345495f6d Mon Sep 17 00:00:00 2001 From: Nicolae Claudius Date: Sun, 1 Sep 2013 22:23:15 +0300 Subject: [PATCH] fix eager load when no db --- config/environments/production.rb | 8 +++++--- entrydns.spec | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index a8b0db6..846dc0c 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -1,9 +1,13 @@ Entrydns::Application.configure do # Settings specified here will take precedence over those in config/application.rb + db_operation = File.basename($0) == "rake" && + %w(db:migrate db:schema:load).any? { |op| op.in?(ARGV) } + # Code is not reloaded between requests, unless rake # https://github.com/activescaffold/active_scaffold/issues/131 - config.cache_classes = (File.basename($0) == "rake" && ARGV.include?("db:migrate")) ? false : true + config.cache_classes = !db_operation + config.eager_load = !db_operation # Full error reports are disabled and caching is turned on config.consider_all_requests_local = false @@ -74,8 +78,6 @@ Entrydns::Application.configure do :domain => 'entrydns.net' } - config.eager_load = true - # Compress JavaScripts and CSS config.assets.js_compressor = :uglifier end diff --git a/entrydns.spec b/entrydns.spec index 6e8018e..de79495 100644 --- a/entrydns.spec +++ b/entrydns.spec @@ -53,7 +53,7 @@ cp config/database.mysql.sample.yml config/database.yml bundle install --deployment --without development test # pre-compile assets -bundle exec rake RAILS_ENV=production db:create db:migrate +bundle exec rake RAILS_ENV=production db:create db:schema:load bundle exec rake RAILS_ENV=production assets:precompile # fix wrong sheebang for unicorn