Reputation: 1099
Is there a way to use external XML (or JSON) as a datasource for models in Rails. E.g. some models use the database for getting data, others "ping" external services for XML.
Upvotes: 4
Views: 1008
Reputation: 43996
You can use ActiveResource for this - it's already part of Rails, and is intended to allow you to integrate with external restful services.
Upvotes: 4
Reputation: 4062
You could override the 'get' methods on the model, to look at your xml (or xml server) instead of looking at the database.
To parse xml on ruby, there are many apis, like rexml and xmlsimple.
Here there's a comparison between both.
Upvotes: -1