views:

37

answers:

1

I'm starting a new iPhone project and I want to get started off on the right foot. It's going to be talking to a Ruby on Rails server for some basic CRUD operations. I'd like to avoid dealing with URLs, HTTP requests and responses, and such. Are there any libraries out there that make this easier?

+1  A: 

It looks like http://iphoneonrails.com makes things pretty simple. You create custom classes in Objective-C that mirror your Ruby classes. You automatically get the following methods for CRUD:

//Create
Dog *dog = [[[Dog alloc] init] autorelease];
dog.name = @"Fido";
[dog saveRemote];

//Read
NSArray *dogs = [Dog findAllRemote];
dog = [Dog findRemote:dog.dogId];

//Update
dog.name = @"Fido Jones";
[dog updateRemote];

//Delete
[dog destroyRemote];

You can also fairly easily add methods to your Objective-C classes to call non-CRUD methods in your Ruby classes.

Algorithmic
It looks like this doesn't work well with Three20. Someone's working on it, but it doesn't look ready yet: http://github.com/searls/TTResource.
Algorithmic