2
如何在Google AppEngine的Jruby上的DataMapper中使用list/array作爲屬性?App Engine Jruby DataMapper列表屬性
如何在Google AppEngine的Jruby上的DataMapper中使用list/array作爲屬性?App Engine Jruby DataMapper列表屬性
這會像has..and..belongs..to..many,無需連接表...
class Person
include DataMapper::Resource
property :id, Serial
property :name, String, :nullable => false
property :project_ids, List
timestamps :at
# project should be flagged as archived, not deleted
def projects
Project.all(:id => project_ids)
end
end
class Project
include DataMapper::Resource
property :id, Serial
property :name, String, :nullable => false
property :archived, Boolean, :default => false
# the join table is bolted onto the person model
def people
Person.all(:project_ids => id)
end
end
是否有不同的方式在App使用JRuby接近建模的任何文件-發動機? – 2010-03-17 19:44:05