我是rails的新手。我爲特定項目創建了一個報告模塊。現在,我們希望在所有項目中都具有通用性,比如報告寶石。我的問題不在於如何創建&使用寶石。我的問題是「如何製作通用報告庫」。例如。我在報告中的輔助模塊,在rails中創建通用模塊
module Libquery
module Helper
include QueryConstants(which is dynamic - based on the project)
#methods
end
end
末
我的方法:每個項目將包括LibQuery ::助手,也將包括其自己的常量文件。
module ProjectX
module Query
module Helper
include Libquery::Helper
#nothing - inherit all helper methods in libquery
end
end
end
但我想知道如果這是最優雅的做事方式?或者有更好的方法來做到這一點?
尊重約定:模塊和類必須是大寫 – apneadiving