Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Model using external data source?
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
David Paschich  
View profile  
 More options Sep 26 2012, 2:53 am
From: David Paschich <dpass...@gmail.com>
Date: Tue, 25 Sep 2012 23:53:15 -0700 (PDT)
Local: Wed, Sep 26 2012 2:53 am
Subject: Re: Model using external data source?

On Tuesday, September 25, 2012 1:08:46 AM UTC-7, Zhongjie Wu wrote:

> Hi, I am writing a management system and one of the datasource is
> external(read-only) and I need to use REST API to access them. Can I just
> reuse the Model part of MVC but override those database access methods to
> do REST calls instead?

Absolutely. The objects in your model don't have to inherit from
ActiveRecord or any other part of Rails if you don't need them to. Just
write up an object to wrap the API calls.

Rails used to have a module called ActiveResource for this, but it seems
nobody liked it enough to keep it working, so it was dropped. In my current
project, I just have to read from the REST API, and
https://github.com/archiloque/rest-client is working well so far.

-David


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.