DataMapper List Property for Engine Jruby Application

How to use list / array property in DataMapper on Jruby in Google AppEngine?

+2


source to share


1 answer


This will work the same as ... and ... next ... without the 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

      

+5


source







All Articles