如何覆盖spree override expired_reimbursement_type和default_reimbursement_type

时间:2016-04-11 13:26:03

标签: spree

在Spree 2.4上,我似乎找不到在我的应用中覆盖expired_reimbursement_type和/或default_reimbursement_type的好方法。

我试过这个

Spree::Reimbursement::ReimbursementTypeEngine.class_eval do
  self.refund_time_constraint = 90.days
  self.default_reimbursement_type = Spree::ReimbursementType::OriginalPayment
  self.exchange_reimbursement_type = Spree::ReimbursementType::StoreCredit
end

还有初始化程序/ spree.rb

Spree::Reimbursement::ReimbursementTypeEngine.refund_time_constraint = 90.days
Spree::Reimbursement::ReimbursementTypeEngine.default_reimbursement_type = Spree::ReimbursementType::OriginalPayment
Spree::Reimbursement::ReimbursementTypeEngine.exchange_reimbursement_type = Spree::ReimbursementType::StoreCredit

但似乎都没有正常工作

1 个答案:

答案 0 :(得分:1)

这可以正常使用

Spree::Reimbursement::ReimbursementTypeEngine.class_eval do
  self.refund_time_constraint = 90.days
  self.default_reimbursement_type = Spree::ReimbursementType::OriginalPayment
  self.expired_reimbursement_type = Spree::ReimbursementType::StoreCredit
end