неинициализированная константа Spree::Calculator::Shipping::Andreani NewShippingCalculator
У меня возникла проблема при создании нового калькулятора доставки:
app / models / Spree / Calculator / Shipping / Andreani.rb:
class Andreani < Spree::Calculator::Shipping::Andreani
def Spree
andreani = 197
return 'andreani'
end
def compute_package(package)
return 'andreani'
end
end
config / spree.rb
config = Rails.application.config
config.spree.calculators.shipping_methods << Spree::Calculator::Shipping::Andreani
ВЫХОД: /home/darthganz/Desktop/datasoftok/config/initializers/spree.rb:34:in
<main>': uninitialized constant Spree::Calculator::Shipping::Andreani (NameError) from /home/darthganz/.rvm/gems/ruby-3.0.2/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:60:in
load 'из /home/darthganz/.rvm/gems/ruby-3.0.2/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:60:in
load' from /home/darthganz/.rvm/gems/ruby-3.0.2/gems/railties-6.1.4.1/lib/rails/engine.rb:681:in
блок в load_config_initializer 'из /home/darthganz/.rvm/gems/ruby-3.0.2/gems/activesupport-6.1.4.1/lib/active_support/notifications.rb:205:in
instrument' from /home/darthganz/.rvm/gems/ruby-3.0.2/gems/railties-6.1.4.1/lib/rails/engine.rb:680:in
load_config_initializer 'из /home/darthganz/.rvm/gems/ruby-3.0.2/gems/railties-6.1.4.1/lib/rails/engine.rb:634:in
block (2 levels) in <class:Engine>' from /home/darthganz/.rvm/gems/ruby-3.0.2/gems/railties-6.1.4.1/lib/rails/engine.rb:633:in
каждый 'из /home/darthganz/.rvm/gems/ruby-3.0.2/gems/railties-6.1.4.1/lib/rails/engine.rb:633:in
block in <class:Engine>' from /home/darthganz/.rvm/gems/ruby-3.0.2/gems/railties-6.1.4.1/lib/rails/initializable.rb:32:in
instance_exec 'из /home/darthganz/.rvm/gems/ruby-3.0.2/gems/railties-6.1.4.1/lib/rails/initializable.rb:32:in
run' from /home/darthganz/.rvm/gems/ruby-3.0.2/gems/railties-6.1.4.1/lib/rails/initializable.rb:61:in
блок в run_initializers 'из /home/darthganz/.rvm/rubies/ruby-3.0.2/lib/ruby/3.0.0/tsort.rb:228:in
block in tsort_each' from /home/darthganz/.rvm/rubies/ruby-3.0.2/lib/ruby/3.0.0/tsort.rb:350:in
блок (2 уровня) в each_strongly_connected_component 'из /home/darthganz/.rvm/rubies/ruby-3.0.2/lib/ruby/3.0.0/tsort.rb:422:in
block (2 levels) in each_strongly_connected_component_from' from /home/darthganz/.rvm/rubies/ruby-3.0.2/lib/ruby/3.0.0/tsort.rb:431:in
each_strongly_connected_component_from 'из /home/darthganz/.rvm/rubies/ruby-3.0.2/lib/ruby/3.0.0/tsort.rb:421:in
block in each_strongly_connected_component_from' from /home/darthganz/.rvm/gems/ruby-3.0.2/gems/railties-6.1.4.1/lib/rails/initializable.rb:50:in
каждый 'из /home/darthganz/.rvm/gems/ruby-3.0.2/gems/railties-6.1.4.1/lib/rails/initializable.rb:50:in
tsort_each_child' from /home/darthganz/.rvm/rubies/ruby-3.0.2/lib/ruby/3.0.0/tsort.rb:415:in
вызов 'из /home/darthganz/.rvm/rubies/ruby-3.0.2/lib/ruby/3.0.0/tsort.rb:415:in
each_strongly_connected_component_from' from /home/darthganz/.rvm/rubies/ruby-3.0.2/lib/ruby/3.0.0/tsort.rb:349:in
блок в each_strongly_connected_component 'из /home/darthganz/.rvm/rubies/ruby-3.0.2/lib/ruby/3.0.0/tsort.rb:347:in
each' from /home/darthganz/.rvm/rubies/ruby-3.0.2/lib/ruby/3.0.0/tsort.rb:347:in
вызов 'из /home/darthganz/.rvm/rubies/ruby-3.0.2/lib/ruby/3.0.0/tsort.rb:347:in
each_strongly_connected_component' from /home/darthganz/.rvm/rubies/ruby-3.0.2/lib/ruby/3.0.0/tsort.rb:226:in
tsort_each 'из /home/darthganz/.rvm/rubies/ruby-3.0.2/lib/ruby/3.0.0/tsort.rb:205:in
tsort_each' from /home/darthganz/.rvm/gems/ruby-3.0.2/gems/railties-6.1.4.1/lib/rails/initializable.rb:60:in
run_initializers 'из /home/darthganz/.rvm/gems/ruby-3.0.2/gems/railties-6.1.4.1/lib/rails/application.rb:391:in
initialize!' from /home/darthganz/Desktop/datasoftok/config/environment.rb:5:in
'из /home/darthganz/.rvm/gems/ruby-3.0.2/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in
require' from /home/darthganz/.rvm/gems/ruby-3.0.2/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in
блокировать в require_with_bootsnap_lfi 'из /home/darthganz/.rvm/gems/ruby-3.0.2/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in
register' from /home/darthganz/.rvm/gems/ruby-3.0.2/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in
require_with_bootsnap_lfi 'из /home/darthganz/.rvm/gems/ruby-3.0.2/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in
require' from /home/darthganz/.rvm/gems/ruby-3.0.2/gems/zeitwerk-2.4.2/lib/zeitwerk/kernel.rb:34:in
require 'из /home/darthganz/.rvm/gems/ruby-3.0.2/gems/bootsnap-1.8.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:54:in `require_relative'