Embedding Rails in a Cocoa app


Has anyone tried to embed rails into a Cocoa app? I have got this
working to a very primitive point using RubyCocoa. After about half an
hour of playing I was able to get WEBrick to serve the rails starter
page inside of a Cocoa app, but that is as far as I have got.

I have an idea for a client/server app where the server is a Cocoa
application that embeds WEBrick (or another server solution possibly)
that serves a rails app that interfaces with the running Cocoa
application via the RubyCocoa bridge.

Is this naive? It seems to me that it should be possible, but I am
fairly new to Rails and semi-new to Ruby. I am also kind of looking for
some reassurance that this isn’t a totally ridiculous idea before I
invest all my time in it.

Thanks for any input.

  • Luke.

Luke D. wrote:


Has anyone tried to embed rails into a Cocoa app? I have got this

James Duncan Davidson recently shipped some kind of book application.

hold on…

/me googles


It’s a thick client for multiple platforms with rails embedded (I


Running rails inside of cocoa sounds like a cool/fun idea, but I can’t
comment on if this is the right approach without knowing more about
what you are trying to accomplish.

Why do you need Cocoa to “wrap” the server. Do you want to do this so
it is easier to install? Do you want to do this so that you can setup
the Cocoa app to configure/modify the rails server? If you’re using a
database, you might consider using Cocoa’s Core Data to connect to the
same database as your rails application. (and have them work together
that way).

The reason for running inside of a Cocoa app is that Rails will be
communicating with the actual application via the RubyCocoa bridge. I
don’t want to give away too many details at the moment considering I am
just trying to get a proof of concept thing going. The whole premise
here is that the client component of the application is actually a web
app which brings cross platform goodness.

A bit of a breakdown…

The server application will be a Cocoa application that interacts with
various other running applications on that machine. The server app
embeds a rails app which provides a way for clients to utilise the
application. Using RubyCocoa, I hope to get the rails app capable of
calling into the Objective-C runtime of the application to make things

Does that explain what I am trying to do?

After a quick browse, this seems slightly different.

It seems to be that the client is embedded (via WebKit), but the server
aspect is operating in a more traditional sense.

Thanks for the links though (y)

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs