In my app resources posted will be in a specially encoded format (x509).
I suppose a simple way of doing it would be to create a middleware
filter that transforms from that to json. This sounds easy enough.
However the 2nd issue is that some resources will also have other
resources embedded within them that I want to create on the fly.
Basically one post might create resources in 2 different collections.
Again I guess I could intercept posts to that collection and then
manually create the resources.
Thirdly each resource has a natural key I want to be its UUID. I see
that Resource allows you to pass an :id or :pk option in it's
initializer, but this seems to mainly used internally when
instantiating from the underlying store. The Resource.create method
which is what is called via a POST doesn't seem to have anyway of
manually setting this.
Now another approach would be to have some way of subclass of Resource
in the style of AR like models. I can see a number of different ways
where this could be implemented, allowing solving the above problems
using method overrides and/or before/after filters. I'm not sure if
that would be against the philosophy of cloudkit? I would be willing
to take a go at it.
P
--
http://agree2.com - Reach Agreement!
http://extraeagle.com - Solutions for the electronic Extra Legal world
http://stakeventures.com - Bootstrapping blog
Congrats on the release Jon,
I have a very simple application I want to write using CloudKit. It
would be perfect in many different ways. There are just 3 things I'm
trying to get my head around.
In my app resources posted will be in a specially encoded format (x509).
I suppose a simple way of doing it would be to create a middleware
filter that transforms from that to json. This sounds easy enough.
However the 2nd issue is that some resources will also have other
resources embedded within them that I want to create on the fly.
Basically one post might create resources in 2 different collections.
Again I guess I could intercept posts to that collection and then
manually create the resources.
Thirdly each resource has a natural key I want to be its UUID. I see
that Resource allows you to pass an :id or :pk option in it's
initializer, but this seems to mainly used internally when
instantiating from the underlying store. The Resource.create method
which is what is called via a POST doesn't seem to have anyway of
manually setting this.
Now another approach would be to have some way of subclass of Resource
in the style of AR like models. I can see a number of different ways
where this could be implemented, allowing solving the above problems
using method overrides and/or before/after filters. I'm not sure if
that would be against the philosophy of cloudkit? I would be willing
to take a go at it.