我有这个,我想在报告::丰田中的 Base :: Helper 中使用 number_front 方法,它给出了我错了:undefined method number_front
module Base
module Helper
def number_front(member)
"***#{member}"
end
end
end
module Report
module Toyota
extend Base::Helper # not sure here, what's the right way to include it
extend ActiveSupport::Concern
included do
comma do
model(mark: 'Toyota') { |number| number_front(number) if number }
end
end
end
end
class Car
include Report::Toyota
end
答案 0 :(得分:2)
而不是
extend Base::Helper
使用
include Base::Helper
不同之处在于include
会将方法添加为实例方法。