Hello -

I'm considering using Datamapper for a project, but I'd need it to
handle composite foreign keys. This seems like it would be a logical
extension of the support for composite primary keys, but it's not
mentioned in the documentation, and I can't find other information on
it online.

As a contrived example, if a post has many numbered comments, and each
comment has its own author information, I guess it would look like:

class Post
  include DataMapper::Resource

  has n, :comments

  property :id, Serial
end


class Comment
  include DataMapper::Resource

  belongs_to :post
  has 1, :author, :child_key => [:post_id, :comment_number]

  property :post_id, Integer, :key => true
  property :number, Integer, :key => true
end


class Author
  include DataMapper::Resource

  belongs_to :comment, :child_key => [:post_id, :comment_number]

  property :post_id, Integer, :key => true
  property :comment_number, Integer, :key => true

  ...(other author information)...
end

Is this sort of thing supported by Datamapper?

Thanks!
Chris

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to