Reputation: 6317
I am creating a Rails application, which rather than using a database for the backend, will communicate with an external REST service.
This will work something like this:
Model.find(1) # GET /model/1
Model.delete(1) # DELETE /model/1
...
The business logic necessary to turn method calls into REST requests belongs in my model. However, there are several different servers that can be queried. Where do I put the connection logic so that:
I am assuming this logic doesn't belong in the model, but I'm not sure where.
Any advice much appreciated.
Upvotes: 0
Views: 871
Reputation: 15634
Have you considered using Active Resource? It is probably meant for almost exactly this use case, if I understand correctly.
Upvotes: 2