In my app, calling SpreeMultiVendor::Spree::Preferences in rails c results in NameError.
So I cannot execute any rake task. :sob:
# bin/rails c
Running via Spring preloader in process 276
Loading development environment (Rails 6.1.3)
[1] pry(main)> SpreeMultiVendor::Configuration
NameError: uninitialized constant SpreeMultiVendor::Spree::Preferences
from /usr/local/lib/ruby/gems/3.0.0/bundler/gems/spree_multi_vendor-bf37f0624cc1/app/models/spree_multi_vendor/configuration.rb:2:in `<module:SpreeMultiVendor>'
Expected Behavior
no errors.
Actual Behavior
NameError.(see above)
Possible Fix
set config.eager_load=true and config.cache_classes = true (and stop spring)
Or
Fork and patch this.
--- a/app/models/spree_multi_vendor/configuration.rb
+++ b/app/models/spree_multi_vendor/configuration.rb
@@ -1,5 +1,5 @@
module SpreeMultiVendor
- class Configuration < Spree::Preferences::Configuration
+ class Configuration < ::Spree::Preferences::Configuration
DEFAULT_VENDORIZED_MODELS ||= %w[product variant stock_location shipping_method].freeze
# Some example preferences are shown below, for more information visit:
Steps to Reproduce
For example, in spec/dummy (created by bundle exec rake test_app) in this repo.
(bundle exec rake test_app)
cd spec/dummy
BUNDLE_GEMFILE=../../Gemfile bundle exec rails c
Type SpreeMultiVendor::Spree::Preferences and hit Enter
[dummy]$ BUNDLE_GEMFILE=../../Gemfile bundle exec rails c
/Users/hoshino/go/src/github.com/route06/spree_multi_vendor/app/models/spree_multi_vendor/spree/order_decorator.rb:69: warning: already initialized constant SpreeMultiVendor::Spree::OrderDecorator::METHOD_NAMES
/Users/hoshino/go/src/github.com/route06/spree_multi_vendor/app/models/spree_multi_vendor/spree/order_decorator.rb:69: warning: previous definition of METHOD_NAMES was here
Loading development environment (Rails 6.1.3)
irb(main):001:0> SpreeMultiVendor::Configuration
Traceback (most recent call last):
1: from (irb):1:in `<main>'
NameError (uninitialized constant SpreeMultiVendor::Spree::Preferences)
Context
In my app, calling
SpreeMultiVendor::Spree::Preferences
inrails c
results inNameError
.So I cannot execute any rake task. :sob:
Expected Behavior
no errors.
Actual Behavior
NameError.(see above)
Possible Fix
config.eager_load=true
andconfig.cache_classes = true
(and stop spring)Or
Steps to Reproduce
For example, in
spec/dummy
(created bybundle exec rake test_app
) in this repo.bundle exec rake test_app
)SpreeMultiVendor::Spree::Preferences
and hit Enterversion
spree-contrib/master bf37f0624cc1a5f7a3b7431136cd8416a54fed60