From 8f2d52b9e3825c36a13183abe103d82be6b286b7 Mon Sep 17 00:00:00 2001 From: Luis Ramos Date: Tue, 27 Oct 2020 13:35:45 +0000 Subject: [PATCH] Revert "Do not reload routes and make spree routes append instead of draw in" This reverts commit cdf4c795c7c7ae18006eb24af9336941361b6b81. --- config/application.rb | 6 ++++++ config/routes/spree.rb | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/config/application.rb b/config/application.rb index ad890e0b2e..f635c67a95 100644 --- a/config/application.rb +++ b/config/application.rb @@ -28,6 +28,12 @@ module Openfoodnetwork Spree::Core::Engine.routes.default_url_options[:host] = 'test.host' if Rails.env = 'test' end + # We reload the routes here + # so that the appended/prepended routes are available to the application. + config.after_initialize do + Rails.application.routes_reloader.reload! + end + initializer "spree.environment", before: :load_config_initializers do |app| app.config.spree = Spree::Core::Environment.new Spree::Config = app.config.spree.preferences # legacy access diff --git a/config/routes/spree.rb b/config/routes/spree.rb index 9b176b652a..cb35c08cbc 100644 --- a/config/routes/spree.rb +++ b/config/routes/spree.rb @@ -1,4 +1,5 @@ -Spree::Core::Engine.routes.append do +# Overriding Devise routes to use our own controller +Spree::Core::Engine.routes.draw do devise_for :spree_user, :class_name => 'Spree::User', :controllers => { :sessions => 'spree/user_sessions',