Monday, July 14, 2008

Take your Rails application offline with the Gears on Rails project

Michael Marcus and Rui Ma, two recent graduates from a masters program at NYU, join us to discuss Gears on Rails, their open source framework that makes it easier than ever to take a Rails code-base offline.

We start out discussing the genesis of the project and what it is trying to do. The sweet spot is building a Rails application that can handle local interactions without having to drop down to Gears JavaScript APIs themselves.

First you install the Gears on Rails plugin via:
ruby script /plugin install
Then you can create a Rails controller and tell it that it is local via acts_as_local :except=>['hello'].

Now you can create an action in the controller by creating a method that uses an API that looks Rails-like:
def create_local
post ="post"));
window.location.reload( false );
In that string, the framework is actually building on Jester, a "JavaScript client for REST APIs that uses Rails conventions". Rui explained how they built out the local versions of the calls.

This means that your architecture revolves around REST calls, and when you are offline they all occur on local data that can sync up later. The synchronization is done for you automatically.

Thanks to Michael and Rui for taking the time to discuss their project with us, and thank you for reading.

Listen to the audio interview directly (or subscribe via iTunes).


  1. Hi, I'm the author of Jester. This is a totally awesome plugin, and a great usage of the Jester library. I'd like to use this in a Camping app, I might have to fork it or something to make it less Rails-specific.

    I'd love to send Michael and Rui an email or something, but I can't find their presence or contact info online. I'll risk posting my email up here publicly -- it's, if they want to reach me about anything.

    Great work!

  2. I'm thrilled that this is getting so much attention! Guess the pressure's on now. :)

    We've created a blog around the Gears on Rails project for ideas and updates, and we'll post as often as we can.

  3. Database synchronization is a big problem with offline Web applications.

    What plans do you have?

    This project caught my eye:

    Combining it with Google Gears could be a good solution.

  4. This comment has been removed by a blog administrator.

  5. This comment has been removed by a blog administrator.

  6. @Tom

    It looks like the SymmetricDS project has not been implemented with SQLite yet, which I believe is what Gears uses.

  7. This comment has been removed by a blog administrator.

  8. This comment has been removed by a blog administrator.

  9. Since so many times there is no update for this project, any problem? or what?