NSRails is a light-weight, drop-in Objective-C framework (iOS or OS X) for simple but powerful communication with your Rails server.
NSRails provides simple, high-level APIs that gives your Objective-C classes ActiveResource-like support. This means CRUD and other operations on your corresponding Rails objects can be called natively via Objective-C methods.
Instances will inherit methods to remotely create, read, update, or destroy a remote object:
Article *newArticle = [[Article alloc] init]; newArticle.title = @"Title"; newArticle.content = @"Some text"; [newArticle remoteCreate:&error]; //This article and its properties created right on a Rails server
Classes will inherit methods to retrieve all objects, or only certain ones:
NSArray *allArticles = [Article remoteAll:&error]; Article *articleNumber1 = [Article remoteObjectWithID:1 error:&error]; // Display your article(s)! They're ready with their properties populated directly from your remote DB
- High-level APIs, yet flexible enough even to work with any RESTful server
- Keeping models and properties of your choice in-sync with those of Rails
- Nesting your related models (has-many, etc)
- Asynchronous requests
- Support for basic HTTP authentication
It's fairly painless. Drop the source folder into your Xcode project, and see this page.
Some more resources:
- Easily translate Rails models into Objective-C classes using autogen tool
- Watch the screencast
- See the Wiki
- Browse the included demo iPhone app - it goes straight to a live Rails app at nsrails.com, so you won't even have to launch a server to get started. The source for this site is also included. Have fun and be civil!
NSRails is published under the MIT license, meaning you can use the sources however you'd like.