I have Point model and a Polygon model. I want to the association PointPolygon to also have a reference to the previous and next point in the Polygon, which are references to the the respective points' ID's from the Points table. I looks like a linked list.
How exactly do I declare these 2 additional attributes in the Point and PoygonPoint models? Thanks. ++++++++++++++ class Point include DataMapper::Resource property :id, Serial property :name, String, :nullable => false, :unique => true property :x, Integer, :nullable => false, :default => 0 property :y, Integer, :nullable => false, :default => 0 has n, :polygon_points has n, :polygons, :through => :polygon_points end class Polygon include DataMapper::Resource property :id, Serial property :name, String, :nullable => false, :unique => true has n, :polygon_points has n, :points, :through => :polygon_points end class PolygonPoint include DataMapper::Resource property :id, Serial belongs_to :polygon, :model => "Lot", :child_key => [:polygon_id] belongs_to :point, :model => "Point", :child_key => [:point_id] belongs_to :point, :model => 'Point', :child_key => [:prev_point_id] belongs_to :point, :model => 'Point', :child_key => [:next_point_id] end
-- You received this message because you are subscribed to the Google Groups "DataMapper" group. To post to this group, send email to datamap...@googlegroups.com. To unsubscribe from this group, send email to datamapper+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/datamapper?hl=en.