I’ve built an app using Ruby On Rails 3, and now, as I’ve got more than one app that use the same models, I would like to build a third app for the model’s logic, and call it from each app, in order to avoid repeating code across apps, etc.
To do that, I’ve thought about building a Rails app, and returning/receiving information through XML, and so far I’ve got no issues…until I’ve started thinking about ActiveRecod works directly with the database, and I no longer want that…now I want my app to call the service, and then communicate with the DB from there.
So, the question is: how can I move all the model’s logic to a webservice without losing ActiveRecord magic in controllers, helpers, etc?
Thanks,
Brian
You can access the service via ActiveResource models – http://api.rubyonrails.org/classes/ActiveResource/Base.html. They mimic much of the basic ActiveRecord functionality.