0

在本地和使用全新安装的生产环境中获取此错误。种子数据已加载。Rails 3.0.3、ruby 1.87(开发)和产品中的 ruby​​ 1.8.7 REE。

spree gems spree (0.30.1) spree_api (0.30.1) spree_auth (0.30.1) spree_core (0.30.1) spree_dash (0.30.1) spree_promo (0.30.1) spree_sample (0.30.1)

开发错误:

=> Booting WEBrick => Rails 3.0.3 application starting in development on http://0.0.0.0:3000 
=> Call with -d to detach => Ctrl-C to shutdown server 
Error registering calculator Calculator::PriceBucket
[2010-11-27 12:57:49] INFO WEBrick 1.3.1 
[2010-11-27 12:57:49] INFO ruby 1.8.7 (2010-08-16) [i686-darwin10.4.3] 
[2010-11-27 12:57:49] INFO WEBrick::HTTPServer#start: pid=18146 port=3000

产品错误:

Error message:
superclass mismatch for class PriceBucket
Exception class:
TypeError
Application root:
/home/deploy/webstores/mystore/current Backtrace:

文件行位置

0 /home/deploy/.bundler/ruby/1.8/spree-e9c3485bf22e/core/app/models/calculator/price_bucket.rb 1
4

1 回答 1

0

这最终对我有用,尽管它与您的错误有很大不同:

还应该注意的是,Rails3 Spree 中的计算方式略有不同。该对象现在包含 的属性item_total,而不仅仅是调用object.length

在我的主要扩展 gem 中:

  def self.activate
    Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
      Rails.env.production? ? require(c) : load(c)
    end
    Calculator::PerWeight.register
  end

在我的自定义计算器中:

def self.register
  super
  ShippingMethod.register_calculator(self)
end
于 2011-02-25T20:28:19.170 回答