我从datamapper http://datamapper.org/getting-started.html
获得了此示例代码class Post
include DataMapper::Resource
property :id, Serial # An auto-increment integer key
property :title, String # A varchar type string, for short strings
property :body, Text # A text block, for longer string data.
property :created_at, DateTime # A DateTime, for any date you might like.
end
有谁能告诉我“财产”是如何产生的?它是函数,变量,类变量或实例变量还是常量?
有时候我也看到了这种代码
class CarModel
attribute :name
attribute :hello
end
但不知道如何生成
答案 0 :(得分:2)