0
是否有可能在關注中使用Amoeba寶石?目前,當我嘗試運行它裏面關注我得到這個錯誤:Rails 4,Amoeba寶石內的疑慮
undefined method `amoeba' for Amoeba:Module
相同的代碼工作的實際模型裏面很好,但我要幹它,因爲它是2之間高度相似的我模型...以下是關注的內容:
module Amoeba
extend ActiveSupport::Concern
amoeba do
enable
customize(lambda { |original, clone|
clone.uid = SecureRandom.hex(2)
clone.activities = []
if original.class.name == "Widget"
clone.bookings = []
end
if orignal.class.name == "Flotsam"
clone.remaining = 100
if original.expiration.past?
clone.expiration = Date.today + 5.years
end
end
if original.icon.present?
clone.icon = original.icon
end
if original.pdf.present?
clone.pdf = original.pdf
end
})
end