Hi! How to use list/array as property in DataMapper on Jruby on Google AppEngine?
+2
A:
This will work like has..and..belongs..to..many, without a join table...
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
John Woodell
2009-10-13 15:05:13
Is there any documentation on the different ways to approach modeling with JRuby on App-Engine?
Ryan Montgomery
2010-03-17 19:44:05