啓發由DataMapper的使用混入怎麼樣,我需要了解如何複製使用混入以下紅寶石混入物業
module Property
def property(name, type, value)
#Some code
end
end
class Weapon
include Property
property :name, :string, "The legendary Sword"
property :attack, :integer, 10
end
class Item
include Property
property :name, :string, "Magic Carpet"
property :description, :string, "Fly you to the moon"
end
但我有一個錯誤,
NoMethodError: undefined method `property' for Route:Class
任何幫助是非常讚賞。謝謝。
阿里嗨, 感謝您詳細的解釋。 –
@GavinYap沒問題:) –