An example iPhone application that talks to a RESTful Rails application to CRUD expenses.
Objective-C Ruby JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



An example iPhone application that talks to a RESTful Rails application to:

  • create an expense (name and amount)
  • read an expense
  • update an expense
  • delete an expense

That's it. It's your basic Rails scaffolding, iPhone style.

The iPhone app is a super stripped down example of how to use ObjectiveResource. The application focuses solely on the basic CRUD operations. I deliberately left out any bells and whistles so they don't get in the way of the fundamentals. Also, synchronous network requests are used to keep the example dead simple. This is generally a bad idea because synchronous network requests block the main UI thread, and people don't like iPhone apps that appear to lock up. You should always use asynchronous requests in your iPhone application.

For a more fleshed out example with asynchronous networking, authentication, nested resources, and error handling, check out the Budget app.


This application is intended as a demonstration of how to use ObjectiveResource to manage a single resource living in a Rails application. I first created this application as one of the examples used in my 360iDev presentation in October 2009.

Oh, and because programming is fun. :-)


  1. Fire up the Rails application:

     $ cd server/expenses
     $ rake db:migrate
     $ ruby script/server
  2. Point your trusty browser at the running Rails app and create an example expense.

  3. Open the iPhone project and run it!

     $ cd client/Expenses    
     $ open Expenses.xcodeproj


This app won't win any design awards, but that's not the point...

Additional Resources

Of course there are alternatives to ObjectiveResource, though they aren't designed specifically to work with Rails:


Mike Clark