我有一个类 GoodsTransaction:
require Rails.root.join('lib','two_parties_transaction.rb')
class GoodsTransaction < Transaction
include TwoPartiesTransaction
def counterparty(org, loop = false)
res = #Some logic
res || super(org)
end
end
其中包括 TwoPartiesTransaction 模块:
module TwoPartiesTransaction
extend ActiveSupport::Concern
included do
def counterparty(org)
#Some logic
end
end
end
并且运行交易对手失败:
muichkine@ubuntu:~/src/white$ rails c
Faraday::Builder is now Faraday::RackBuilder.
Loading development environment (Rails 4.0.0)
2.0.0p247 :001 > tr = GoodsTransaction.new
=> #<GoodsTransaction _id: 5264e2eb75627540dd000000, e(end_date): nil, p(span): nil, s(start_date): nil, u(span_unit): nil, _type: "GoodsTransaction", a(autobook): nil, c(forced_close): nil, d(public_id): nil, k(autobook_period): nil, l(label): nil, n(autobook_number): nil, t(autobook_until): nil, contact_ids: nil, parent_id: nil, fc(creditor): nil, fd(debtor): nil>
2.0.0p247 :002 > tr.counterparty(nil)
NoMethodError: super: no superclass method `counterparty' for #<GoodsTransaction:0x000000090fe1d8>
from /home/muichkine/src/white/app/models/transactions/goods_transaction.rb:148:in `counterparty'
我在做什么跳过超级 coutnerparty 方法?