Nested resources in cloudkit

5 views
Skip to first unread message

crofty

unread,
Jun 5, 2009, 8:55:04 PM6/5/09
to CloudKit
Hi,
I've just started looking at Cloudkit so bear with me if this is a
stupid question. How do you handle nested resources or has_many
relationships between resources in Cloudkit?
Say you have a projects resource and a notes resource and each project
has many notes. What is the best way to set this up?
Can you somehow nest the notes resource so that the notes for a
project are accessed at projects/:id/notes. Or do you give each note
a project_id attribute?
Thanks
James

Jon Crosby

unread,
Jun 7, 2009, 2:11:52 PM6/7/09
to clou...@googlegroups.com
James,

The plan for nested resources is to add them via rack middleware once JSONQuery support is ready. This will allow middleware to map nested resource queries to normal queries on the resource with added ("where project = X") requirements.

As an aside, I would recommend not using a project_id attribute in your note resources. Rather, I would recommend using a project's URI and calling the property "project" or "project_uri." That will allow clients to navigate your tree without having to know how to assemble structures based on assumed directory nesting and ID structures.

-Jon
Reply all
Reply to author
Forward
0 new messages