diff --git a/app/controllers/spree/locale_controller.rb b/lib/controllers/spree/locale_controller.rb similarity index 100% rename from app/controllers/spree/locale_controller.rb rename to lib/controllers/spree/locale_controller.rb diff --git a/lib/spree_i18n/engine.rb b/lib/spree_i18n/engine.rb index 964f37f68..8673e140d 100644 --- a/lib/spree_i18n/engine.rb +++ b/lib/spree_i18n/engine.rb @@ -26,6 +26,16 @@ def self.activate Dir.glob(File.join(File.dirname(__FILE__), '../../app/**/*_decorator*.rb')) do |c| Rails.configuration.cache_classes ? require(c) : load(c) end + + if self.frontend_available? + Dir.glob(File.join(File.dirname(__FILE__), '../controllers/**/*.rb')) do |c| + Rails.configuration.cache_classes ? require(c) : load(c) + end + end + end + + def self.frontend_available? + @@frontend_available ||= ::Rails::Engine.subclasses.map(&:instance).map{ |e| e.class.to_s }.include?('Spree::Frontend::Engine') end config.to_prepare(&method(:activate).to_proc)