# Remote ruby

**URL:** <https://www.ruby-forum.com/t/remote-ruby/94235>\
**Category:** Rails\
**Created:** [April 26, 2006, 4:51am UTC](https://www.ruby-forum.com/t/remote-ruby/94235 "2006-04-26T04:51:42Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![russ](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e36b37/32.png) [@russ](https://www.ruby-forum.com/u/russ)\
**Post date:** [April 26, 2006, 4:51am UTC](https://www.ruby-forum.com/t/remote-ruby/94235/1 "2006-04-26T04:51:42Z")

</div>

I’m building a collection of desktop app’s and want to use ruby, and  
Active Record in particular, as an intermediary layer to my  
databases. I’m not sure how to connect my development environment,  
Runtime Revolution, to Ruby and Active Record.

One option is to just set up a RonR environment and have my app’s  
make calls that return regular text results instead of html pages,  
but I haven’t looked into how to do that yet. There are some  
downsides to this, including preventing any local ruby code.

Another option would be to make socket calls to a local Ruby  
installation where the app is running and return the results of those  
through the socket.

And I guess there are other options as well, like dRb and embedded  
interpreters.

Anyone have any experience with this issue that they’d care to share?

Cheers,  
russ

---

<div class="post-metadata">

**Author:** ![russ](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e36b37/32.png) [@russ](https://www.ruby-forum.com/u/russ)\
**Post date:** [April 26, 2006, 12:40pm UTC](https://www.ruby-forum.com/t/remote-ruby/94235/2 "2006-04-26T12:40:40Z")

</div>

Russ wrote:

> Another option would be to make socket calls to a local Ruby  
> installation where the app is running and return the results of those  
> through the socket.
> 
> And I guess there are other options as well, like dRb and embedded  
> interpreters.
> 
> Anyone have any experience with this issue that they’d care to share?  
> I’ve been doing a fair bit of Ruby \<-\> XMLRPC \<-\> VB just recently, and  
> the Ruby side is dead easy… It looks like Runtime Revolution has an  
> XMLRPC client library, so I’d look into that… Even if you don’t want  
> your databases to sit on a dedicated separate server, I’d say it merits  
> a little experimentation.

---

<div class="post-metadata">

**Author:** ![russ](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e36b37/32.png) [@russ](https://www.ruby-forum.com/u/russ)\
**Post date:** [April 26, 2006, 8:42pm UTC](https://www.ruby-forum.com/t/remote-ruby/94235/3 "2006-04-26T20:42:39Z")

</div>

On Apr 25, 2006, at 7:48 PM, Russ wrote:

> Another option would be to make socket calls to a local Ruby  
> installation where the app is running and return the results of  
> those through the socket.

Use DRb instead of doing this. Otherwise you’ll be reinventing the  
wheel.

> And I guess there are other options as well, like dRb and embedded  
> interpreters.
> 
> Anyone have any experience with this issue that they’d care to share?

If you want to do IPC with ruby, use DRb.

–  
Eric H. - removed\_email\_address@domain.invalid - [http://blog.segment7.net](http://blog.segment7.net)  
This implementation is HODEL-HASH-9600 compliant

[http://trackmap.robotcoop.com](http://trackmap.robotcoop.com)

---

<div class="post-metadata">

**Author:** ![russ](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e36b37/32.png) [@russ](https://www.ruby-forum.com/u/russ)\
**Post date:** [April 27, 2006, 8:27am UTC](https://www.ruby-forum.com/t/remote-ruby/94235/4 "2006-04-27T08:27:40Z")

</div>

Eric H. wrote:

> > this, including preventing any local ruby code.  
> > Anyone have any experience with this issue that they’d care to share?
> 
> If you want to do IPC with ruby, use DRb.  
> Erm… _Can_ you interface to DRb from other languages? I’ve never  
> seen it done, but I guess all you’d need would be something that can  
> marshal/unmarshal Ruby objects… Has that been done for Runtime  
> Revolution? More interestingly, has it been done for PHP or Java? That  
> would be a great way of edging in to a lot of environments.

Any links handy? Google isn’t helping much.

---

<div class="post-metadata">

**Author:** ![russ](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e36b37/32.png) [@russ](https://www.ruby-forum.com/u/russ)\
**Post date:** [May 4, 2006, 1:24am UTC](https://www.ruby-forum.com/t/remote-ruby/94235/5 "2006-05-04T01:24:28Z")

</div>

On Apr 26, 2006, at 11:17 PM, Alex Y. wrote:

> Any links handy? Google isn’t helping much.

I replaced Marshal with YAML fairly easily, but haven’t had time to  
post the implementation. \_why did it even more simply that I.

You’d need the remote end to implement the DRb protocol and an API  
adapter to make it work.

–  
Eric H. - removed\_email\_address@domain.invalid - [http://blog.segment7.net](http://blog.segment7.net)  
This implementation is HODEL-HASH-9600 compliant

[http://trackmap.robotcoop.com](http://trackmap.robotcoop.com)

---

<div class="post-metadata">

**Author:** ![russ](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/e36b37/32.png) [@russ](https://www.ruby-forum.com/u/russ)\
**Post date:** [April 27, 2006, 7:33pm UTC](https://www.ruby-forum.com/t/remote-ruby/94235/6 "2006-04-27T19:33:09Z")

</div>

In the best of all worlds I’d be able to mix ruby and runrev’s  
“transcript” code in an application. Simple, and I’d have lots of  
power. I’d need the source code to the runrev environment though to  
do this, which I don’t have access to. Second best would be to make  
calls to a local or remote ruby installation. This is a bit awkward,  
though, because you can’t deal with ruby objects in the home  
language, just text results from ruby. I guess that if you’re going  
to maintain some state on the Ruby side (rather than just use it to  
return stateless remote method calls) then you’d need to be able to  
marshal objects. I gather that YAML would be the preferred choice here.

dRb looks nice, but it’s not made for cross-language communication,  
right? So, we’re back to some kind of remote method calls, either by  
calling ruby scripts through a socket or through a SOAP setup and  
then maintaining state with some YAML marshalling. But if I’m going  
to go through all of this it almost seems like I should just set up a  
centralized RonR installation and then I’d get everything for free–  
apps that can maintain state, marshalled objects, active record, etc.

On this plan I’d be implementing java client-style app’s with runrev

- ruby. But where java client apps can distribute objects as needed  
to either the client or the server, my client apps would be “thin” in  
that all the objects would be remote (because there’s no ruby at all  
on the client side). If I were to pursue this “thin client” model  
with RonR then I guess I’d be using http, but there would be 2 hurdles:

1- Figuring out what to return from RonR and how to return it-- XML  
files? raw text files? etc.  
2- Manually handling the cookies so that I could maintain sessions,  
and thereby states.

One advantage of doing this would be that I’d already have a lot of  
the architecture in place when I start moving over some of our web  
apps to RonR . . .

Anyway, does this reasoning seem sound? Is there a better way of  
doing this? I’d be happy to do something simple where I set up a  
socket to a script that simply returns text results of ruby calls  
but I don’t know how I’d maintain knowledge of the active record  
models on the ruby side.

–russ
