From b67c8cc9f1dc01291cdac78cee010aac26206b53 Mon Sep 17 00:00:00 2001 From: Kristina Lim Date: Mon, 6 Aug 2018 09:58:40 +0800 Subject: [PATCH] Improve requiring of additional routes This is more appropriate, and allows changes the separate route files to be loaded automatically in the development environment. --- config/application.rb | 6 ++++++ config/routes.rb | 3 --- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/config/application.rb b/config/application.rb index f93d224129..ea3539556b 100644 --- a/config/application.rb +++ b/config/application.rb @@ -92,6 +92,12 @@ module Openfoodnetwork #{config.root}/app/jobs ) + config.paths["config/routes"] = %w( + config/routes.rb + config/routes/admin.rb + config/routes/spree.rb + ).map { |relative_path| Rails.root.join(relative_path) } + # Only load the plugins named here, in the order given (default is alphabetical). # :all can be used as a placeholder for all plugins not explicitly named. # config.plugins = [ :exception_notification, :ssl_requirement, :all ] diff --git a/config/routes.rb b/config/routes.rb index ad0d3dcc32..42488bf336 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -112,6 +112,3 @@ Openfoodnetwork::Application.routes.draw do mount Spree::Core::Engine, :at => '/' end - -require Rails.root.join("config/routes/admin.rb") -require Rails.root.join("config/routes/spree.rb")