Can anyone point me to documentation, how to's, etc about how to create
an active resource server. I get its trivial to create a client. But
I'm wanting to create a server that can be used by input forms and also
by an active resource client.
The big mystery to me is how (or if) the xml coming in from an active
resource client gets transformed into the normal "params" argument and
how exactly does that happen? Is it configurable? etc.
Pointing to the code that does this would work too.
Isn't this just a matter of setting up your rails app RESTfully?
I don't think you have XML coming in from the client--just HTTP
requests, with a URI (from which the routing magic derives many incoming
parameters, just like it does when a request comes from a browser) and
verbs (get/post, etc.) and session vars. From the point of view of your
app, you don't care whether the request came from a browser or an active
resource client--communication happens, things get created, moved
around, deleted, etc.
Probably some of that is wrong--but my understanding is that the main
reason you'd bother with the REST stuff is that you wind up w/an
automatable application.
Just to be clear... You have one app with RESTful routes that does
all the typical stuff that you expect to do using ActiveRecord.
Normal forms posting to create and update, etc. If you've used the
'normal' scaffolded controllers you don't need to do anything new
here.
Then there's the "ActiveResource' application. This application does
the same basic thing as the previous one with respect to HTTP
requests. The difference is that the ActiveResource models use
something similar to 'formated_model_path(@model, :xml)' to do CRUD.
That means they don't send requests in XML -- they send 'normal' http
requests and ask for the response in XML. ActiveResource _consumes_
xml (ActiveResource::Base#load_attributes_from_response). The onus is
on the ActiveResource model to parse XML, not your controllers.