[Ruby] Activerecord for non sql backends

Aaron Patterson aaron at tenderlovemaking.com
Tue Oct 23 08:20:45 PDT 2007


On Mon, Oct 22, 2007 at 11:46:01PM -0700, Chris Ochs wrote:
> So just recently I lost the debate at work about using an rdbms versus 
> starting out with a more scalable distributed system (I was for the 
> former).  So now I'm doing some research to see if I can adapt 
> activerecord to a non sql backend.  If not I'm probably going to suggest 
> not even using rails, which I really hate to do.  Unfortunately the team 
> I'm working with is more than happy to write their own web framework to 
> keep their distributed storage system. 
> 
> The data store will be accessed through http calls, very similiar to 
> what is already available in activeresource.  The transport layer is 
> json (for now at least).  My first question is, outside of associations 
> and the canned validations, what would I be missing by using 
> activeresource instead of activerecord?  Would unit testing fly out the 
> door also?

>From what I've read, it looks like you wouldn't be missing out on much.
Though I haven't actually used ActiveResources.  :-)

Unit testing should never fly out the door!  Unfortunately it looks like
you wouldn't get to use fixtures, and you would have to mock the
response from the server.

  http://seangeo.blogspot.com/2007/09/testing-activeresource.html

> 
> Secondly, if I give up too much by using activeresource, I'm considering 
> ways to keep activerecord.  I was thinking of something like the 
> tableless model together with a mixin to override methods such as find 
> and save, which would connect via http to our backend services instead 
> of going through the adaptor.
> 
> Thoughts, suggestions?

I think you would still have the testing hurdles to overcome if you
shoehorned that stuff in to ActiveRecord.  I would stick with
ActiveResource since it looks like that already has Mock objects built
for testing.

-- 
Aaron Patterson
http://tenderlovemaking.com/


More information about the Ruby mailing list