I started with ActiveResource, but quickly hit the wall. Failed to get ActiveResource to work when overriding to_json and to_xml in the base model. In addition, it was not possible to make the representation of resources an injection of links into the generated XML document. Oh by the way, I'm using Rails 3.2.1.
I did a little work and found out about his jewelry. I tried, for some reason, did not work for me. So my question is:
If I have one resource (e.g. books) hosted on one website (something like http://books.org ) and another resource (say students, http://students.org ) hosted on another website, how can I get books to present to students in their full HATEOS glory?
I managed to get a book resource to introduce myself to a student as an XML document. I did this using the Vanilla Rails ActiveResource on the student site. I created a Books resource that inherits from ActiveResource::Base . Then I pointed out self.site and self.element_name , after which I was able to fulfill some rudimentary queries, similar to ActiveRecord, to the deleted book site. The only things that worked for me were Book.all and Book.find(1) . Even this was unsatisfactory because the view contained all the columns of the database, and I wanted to at least delete some of them, which turned out to be impossible.
Now that I have abandoned this approach, I wonder if Rails has a working example where you can build a more complex representation of a resource (i.e. a book) that will contain links that will control the state of the translation application? It is simply unbelievable to me that such a simple requirement seems so devilishly complex in Rails. All I am trying to do is create a representation of the resource that will contain some links that will direct the consumer to discover what this resource is capable of. What interests me most is the implementation of a workflow, which is a multi-level type of dialog discovery process.
source share