应该在哪里重新定义常量变量?
在我的情况下,Spree :: Order :: PAYMENT_STATES将被更改
之前:
setup_view
之后(post_pay添加)
Spree::Order::PAYMENT_STATES = %w(balance_due checkout completed credit_owed failed paid pending processing void).freeze
所以在哪个文件应该" Spree :: Order :: PAYMENT_STATES"以最好的方式重新定义?
答案 0 :(得分:0)
在您的Spree应用中,创建一个文件:app/models/spree/order_decorator.rb
,其中包含以下代码:
Spree::Order.class_eval do
PAYMENT_STATES = %w(balance_due checkout completed credit_owed failed paid pending processing void post_pay).freeze
end
这将覆盖现有的Spree :: Order :: PAYMENT_STATES变量。那应该是它!