我正在实现一个模块,并使用 RoR 的 ActiveSupport::Concern 特性将其包含在我的类中。我在该模块中使用了 included do …… end 块,但在“included do”行上遇到了“参数错误(0 个对于 1 个)”的错误。
module Icecream
extend ActiveSupport::Concerns
included do #throws error wrong no of arguments(0 for 1))
has_many :flavours
scope :icecreams, ->{where("has_icecreams = ?", true)}
end
.
.
.
.
.
end
包括块(included do block)需要参数吗?