From 0e1e0fee2362f2458919e31eb7ebb581cfe5eadf Mon Sep 17 00:00:00 2001 From: Michael Walker Date: Thu, 3 Jan 2019 15:58:46 +0000 Subject: [PATCH] Fix bad method invocation for enable_railtie_for? --- CHANGELOG.md | 2 ++ lib/govuk_app_config/railtie.rb | 12 ++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a23264c9..8a05b47c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +* Fix crash on start due to incorrect method invocation. + # 1.11.0 * Disable X-Ray entirely if the `GOVUK_APP_CONFIG_DISABLE_XRAY` diff --git a/lib/govuk_app_config/railtie.rb b/lib/govuk_app_config/railtie.rb index 9fecab42..212834f3 100644 --- a/lib/govuk_app_config/railtie.rb +++ b/lib/govuk_app_config/railtie.rb @@ -1,7 +1,11 @@ module GovukAppConfig class Railtie < Rails::Railtie + def self.enable_railtie_for?(name) + Rails.env.production? && !ENV.has_key?("GOVUK_APP_CONFIG_DISABLE_#{name.upcase}") + end + initializer('govuk_app_config') do |app| - GovukXRay.initialize(app) if enable_railtie_for?('xray') + GovukXRay.initialize(app) if self.enable_railtie_for?('xray') end config.before_initialize do @@ -9,11 +13,7 @@ class Railtie < Rails::Railtie end config.after_initialize do - GovukXRay.start if enable_railtie_for?('xray') - end - - def self.enable_railtie_for?(name) - Rails.env.production? && !ENV.has_key?("GOVUK_APP_CONFIG_DISABLE_#{name.upcase}") + GovukXRay.start if self.enable_railtie_for?('xray') end end end