我在我的大禮包中使用spree_multi_currency gem https://github.com/pronix/spree-multi-currency。它工作,但是當我添加產品到購物車當時它給錯誤,如Spree多種貨幣
undefined method `target_shipment=' for #<Spree::Variant:0xb4ea7b80>
def add_to_line_item(line_item, variant, quantity, currency = nil, shipment = nil)
if line_item
line_item.target_shipment = shipment
line_item.quantity += quantity.to_i
line_item.currency = currency unless currency.nil?
else
.......
end
這裏是我的全部跟蹤
activemodel (4.0.2) lib/active_model/attribute_methods.rb:439:in `method_missing'
activerecord (4.0.2) lib/active_record/attribute_methods.rb:155:in `method_missing'
/home/tps/.rvm/gems/ruby-2.0.0-p247/bundler/gems/spree-multi-currency-0abaa72ab8ed/app/models/spree/order_decorator.rb:7:in `add_to_line_item'
/home/tps/.rvm/gems/ruby-2.0.0-p247/bundler/gems/spree-99a6ad9f0e4e/core/app/models/spree/order_contents.rb:10:in `add'
/home/tps/.rvm/gems/ruby-2.0.0-p247/bundler/gems/spree-99a6ad9f0e4e/core/app/models/spree/order_populator.rb:49:in `attempt_cart_add'
/home/tps/.rvm/gems/ruby-2.0.0-p247/bundler/gems/spree-99a6ad9f0e4e/core/app/models/spree/order_populator.rb:26:in `block in populate'
/home/tps/.rvm/gems/ruby-2.0.0-p247/bundler/gems/spree-99a6ad9f0e4e/core/app/models/spree/order_populator.rb:25:in `each'
/home/tps/.rvm/gems/ruby-2.0.0-p247/bundler/gems/spree-99a6ad9f0e4e/core/app/models/spree/order_populator.rb:25:in `populate'
/home/tps/.rvm/gems/ruby-2.0.0-p247/bundler/gems/spree-99a6ad9f0e4e/frontend/app/controllers/spree/orders_controller.rb:44:in `populate'
actionpack (4.0.2) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (4.0.2) lib/abstract_controller/base.rb:189:in `process_action'
在此先感謝。
你可以添加一個完整的堆棧跟蹤?不確定target_shipment來自哪裏,能夠幫助您解答問題。 – GeekOnCoffee
@GeekOnCoffee我添加了完整的跟蹤。 –
這個網站是公開的嗎?我們一直在尋找瘋狂的多貨幣示例。 – GeekOnCoffee