# Replacing the database in Active Record with RPC-based interface

**URL:** <https://www.ruby-forum.com/t/replacing-the-database-in-active-record-with-rpc-based-interface/121502>\
**Category:** Rails\
**Created:** [November 28, 2007, 2:44pm UTC](https://www.ruby-forum.com/t/replacing-the-database-in-active-record-with-rpc-based-interface/121502 "2007-11-28T14:44:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stefan\_Magnus\_Landr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/9d8465/32.png) [@Stefan\_Magnus\_Landr](https://www.ruby-forum.com/u/Stefan_Magnus_Landr)\
**Post date:** [November 28, 2007, 2:44pm UTC](https://www.ruby-forum.com/t/replacing-the-database-in-active-record-with-rpc-based-interface/121502/1 "2007-11-28T14:44:48Z")

</div>

Hi there,

We’re about to move our persistent store from a MySQL database to an  
RPC-based data store.

However, we really like programming against the AR-api, and would like  
to keep as much as possible from, so that we can keep stuff like  
callbacks, validations, relations etc.

How would you do it?

Does it make sense to replace the mysql-adapter with and RPC-based  
adapter, translating SQL statements into equivalent rpc calls? And the  
convert the result-set into whatever AR uses in its conversion into  
objects?

---

<div class="post-metadata">

**Author:** ![Stefan\_Magnus\_Landr](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/9d8465/32.png) [@Stefan\_Magnus\_Landr](https://www.ruby-forum.com/u/Stefan_Magnus_Landr)\
**Post date:** [November 28, 2007, 4:28pm UTC](https://www.ruby-forum.com/t/replacing-the-database-in-active-record-with-rpc-based-interface/121502/2 "2007-11-28T16:28:08Z")

</div>

On 11/28/07, Stefan Magnus Landrø [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> How would you do it?
> 
> Does it make sense to replace the mysql-adapter with and RPC-based  
> adapter, translating SQL statements into equivalent rpc calls? And the  
> convert the result-set into whatever AR uses in its conversion into  
> objects?

It’s probably easiest to create your own model class from scratch that  
mimics the same API. I started working on porting more abstract model  
concepts (observers, validators, callbacks, etc) to a very  
experimental ActiveModel project so this job should be easier in the  
future. But, Rails 2.0 has taken priority.

–  
Rick O.  
[http://lighthouseapp.com](http://lighthouseapp.com)  
[http://weblog.techno-weenie.net](http://weblog.techno-weenie.net)  
[http://mephistoblog.com](http://mephistoblog.com)
