狂欢错误 - 错误注册计算器计算器:: PriceBucket

时间:2010-11-27 18:30:22

标签: ruby-on-rails ruby-on-rails-3 spree

在本地和生产中以干净安装方式获取此错误。种子数据已加载。 Rails 3.0.3,ruby 1.87(开发)和ruby 1.8.7 REE in prod。

狂欢宝石 狂欢(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

1 个答案:

答案 0 :(得分:0)

这最终为我工作,虽然它与你的错误有很大不同:

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

在我的主要扩展宝石中:

  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