Insights on Ruby, Git, jQuery, Cappuccino, WordPress, Debian and OS X. Please subscribe if you find something useful!

Cappuccino On Rails

Posted: January 12th, 2010 | Author: Jerod | Filed under: Cappuccino, Projects | Tags: | View Comments

I’m happy to announce the release of CappuccinoResource (CR), a library dedicated to interfacing between a Cappuccino front-end and a Rails back-end.

CR should feel very familiar to Rails developers. Its interface is akin to ActiveResource and it borrows heavily from the (very good) ObjectiveResource library for the iPhone.

All basic CRUD operations are supported, and you can perform advanced finds with arbitrary parameters. A brief example of fetching a record, modifying it, and saving it:

var post = [Post find:@"42"];
[post setTitle:@"Why X is Better than Y"];
[post save];

Check out the README on the project’s page on GitHub for more details and usage examples.

Live Demo

I also created a demo application which is a simplified clone of OS X’s Address Book. The demo is live on Heroku. Check it out. The source for the demo is also on GitHub.

If you’re a Rails developer waiting for a good opportunity to try out Cappuccino, there’s no better time than now.

If you’re a Cappuccino developer looking for an easy-to-use, powerful back-end for your applications, Rails might be the answer for you.

CR is a young project, but it drives one of my client applications that is production-ready (albeit not deployed), so I believe it is ready for prime time. Please try it and let me know how it goes.

Fork, report issues, et cetera.


View Comments on “Cappuccino On Rails”

  1. 1 Douglas Neiner said at 4:29 am on January 13th, 2010:

    Jerod, this looks fantastic! I haven't taken the time to even play with Cappuccino yet, so I maybe this is my chance!

  2. 2 uberVU - social comments said at 10:25 am on January 13th, 2010:

    Social comments and analytics for this post…

    This post was mentioned on Twitter by kicauan: Cappuccino on Rails – http://su.pr/2LDHth...

  3. 3 Jerod Santo said at 1:47 pm on January 13th, 2010:

    Thanks Doug!

    Cappuccino is very cool when building rich web applications. I spent the last couple of months working on a client project that has turned out very well. Its amazing how much you can do without writing a single line of HTML or CSS.

    Do give it a try if you get a chance.

  4. 4 Ted said at 2:24 pm on January 13th, 2010:

    Nice work. This looks like a really good library.

    I've been curious about Objective-J.. how much modification was necessary to go from ActiveResource to CR? I guess you can do away with all the parsing code, for the most part, and just use JSON, but what about the reset of it?

  5. 5 Jerod Santo said at 2:32 pm on January 13th, 2010:

    Hi Ted-

    I only mimicked ActiveResource's interface, not how it works (I've never read AR's codebase). You are right though, handling JSON responses are very easy. All I had to do in CR is determine what kind of response it was (string, date, number, etc) before setting the matching ivar because Cappuccino doesn't store ivar types for later retrieval (yet).

    Overall working with Objective-J is great. The syntax was strange to me at first, but once you get used to it it feels very flexible. If you are familiar with Objective-C you'll pick it up in no time. Plus, since its a strict superset of JavaScript you can use everything JavaScript has to offer without any problems.

    For one project I even mixed in Underscore.js and was using _.each, _.include, and all the other goodies that library provides right in with my Objective-J code. Very cool.

  6. 6 Edward Ocampo-Gooding said at 3:53 pm on January 13th, 2010:

    This looks pretty similar to Nick Small's CPActiveRecord: http://github.com/nciagra/Cappuccino-Extensions...…

    Was there any code borrowed?

  7. 7 Jerod Santo said at 4:03 pm on January 13th, 2010:

    Actually, I was using CPActiveRecord for some time on my application before writing CR (I even contributed a couple of small things to his library). However, my application's needs outgrew that library and as I spoke with Nick he stated that it might take a rewrite on his part to facilitate them. That is when I decided to write a separate library.

    There may be one or two lines of code borrowed, but more importantly I borrowed a lot of the good ideas Nick included (specifically, the notification system). I also borrowed ideas from ObjectiveResource as that project has a very similar goal.

  8. 8 SIngAlong said at 4:54 pm on January 13th, 2010:

    Now it would be nice to have a HowTo for those amateurs like me and Douglas to start using CR with capp and Rails instead of going thru a full circle learning Capp and then figuring out how to connect it to a rails backend. I understand learning capp is essential to use CR but still a lot of people would be comfortable with a howto that introduces them to capp and then to CR, therefore allowing them to start off with rails backends with capp

  9. 9 Jerod Santo said at 5:00 pm on January 13th, 2010:

    I think that is a good idea. There is a lot to learn with Capp (since you're picking up a language and a framework at the same time). The demo application I wrote was intended to help people see how the two work together. Perhaps I should write a blog post (or screencast, if it isnt too long) walking through how I created the demo app.

    If you want a good resource list on learning Objective-J and Cappuccino, check out a blog post I created sometime last year:

    http://blog.jerodsanto.net/2009/11/learning-cap...

  10. 10 Tweets that mention Cappuccino on Rails | blogt0sk1 -- Topsy.com said at 8:32 pm on January 13th, 2010:

    [...] This post was mentioned on Twitter by uosuıqoɹ ɯoʇ, uosuıqoɹ ɯoʇ, Javascript News, Francisco Tolmasky, Leon Ho and others. Leon Ho said: Cappuccino On Rails http://bit.ly/5Vmqxl [...]

  11. 11 aaronbrethorst said at 10:09 pm on January 13th, 2010:

    woohoo! this looks awesome, thanks!

  12. 12 joely said at 12:07 am on January 14th, 2010:

    Jerod, I've been working with Cappuccino, but my background is Cocoa, so this does some “heavy lifting” for me. Thank you!

  13. 13 Jerod Santo said at 2:35 pm on January 14th, 2010:

    Very cool, happy to help out. Please let me know if you release anything that uses my library!

  14. 14 Michaël Villar said at 12:06 pm on January 17th, 2010:

    That looks nice. I developed something similar for myself. It's great to see people around working on this. I'll check it out to inspire me :)

  15. 15 Espresso Machines, coffee beans and espresso equipment. » Cappuccino » Cappuccino on Rails | blogt0sk1 said at 8:13 pm on January 17th, 2010:

    [...] Cappuccino on Rails | blogt0sk1 [...]

  16. 16 Интересни неща от изминалата седмица | NeXt said at 5:07 am on January 24th, 2010:

    [...] Cappuccino On Rails – това не е от Вторник, но тогава го видях. А Cappuccino ( и  SproutCore ) са два проекта, който следя с особен интерес. Още повече интеграцията им с Ruby става все по-лесна [...]

  17. 17 Espresso Machines, coffee beans and espresso equipment. » Cappuccino » Cappuccino on Rails | blogt0sk1 said at 8:12 pm on January 28th, 2010:

    [...] http://blog.jerodsanto.net/2010/01/cappuccino-on-rails/@me1000 http://blog.jerodsanto.net/2010/01/cappuccino-on-rails/ Post Published: 29 January 2010 Author: admin Found in section: [...]

  18. 18 amorican said at 1:50 am on May 19th, 2010:

    I'm new to Cappuccino and the addressbook demo helped me a lot. However, I'm using the Xcode plugin which uses the latest version of the framework (0.8.1), with which CappuccinoResource doesn't work. If I take the frameworks from the demo, then my cib file is not fully rendered (tableViews disappear). I am trying to get a web application off the ground which uses a lot of table views with a rails backend, right now I've hit a wall.
    Is this a known issue and is there any update planned?
    Thanks!

  19. 19 amorican said at 3:10 am on May 19th, 2010:

    Ignore my post, just grabbed the update on github. Thanks again.

  20. 20 air jordan 13 said at 6:18 am on July 5th, 2010:

    Mark S. is definitely on the right track. If you want to get a professional looking email address, Id recommend buying your name domain name, like or
    Gucci sweaters
    If its common it might be difficult to get, however, be creative and you can usually find something.

  21. 21 plus size clothing said at 6:34 am on July 5th, 2010:

    I am new to this, but look so nice.

  22. 22 air jordan 7 said at 6:12 am on July 13th, 2010:

    Yeah,air force 1 shoes I have to admire the landlord's unique point of view,ugg boots for sale this article is very comprehensive and considerable on the analyse, and greatly inspired me. In addition, I would like to share that some other blog's article, content is also very good, if you scan it,there will be a suprise!ugg boots for sale

  23. 23 free_tv said at 10:16 am on August 27th, 2010:

    Hello!
    free tv ,

  24. 24 direct_tv said at 10:16 am on August 27th, 2010:

    Hello!
    direct tv ,

  25. 25 abs_exercises said at 10:16 am on August 27th, 2010:

    Hello!
    abs exercises ,

  26. 26 generic_cialis said at 10:16 pm on August 27th, 2010:

    Hello!
    generic cialis ,

  27. 27 viagra said at 10:17 pm on August 27th, 2010:

    Hello!
    viagra ,

  28. 28 health said at 10:17 pm on August 27th, 2010:

    Hello!
    affordable health insurance ,

  29. 29 cialis said at 1:06 pm on August 28th, 2010:

    Hello!
    cialis ,

  30. 30 cialis said at 1:07 pm on August 28th, 2010:

    Hello!
    cialis ,

  31. 31 cialis said at 1:07 pm on August 28th, 2010:

    Hello!
    cialis ,

  32. 32 sonneandgone said at 2:24 pm on August 28th, 2010:

    Fantastic site I loved reading your info

    party supplies

  33. 33 viagra said at 10:09 pm on August 28th, 2010:

    Hello!
    viagra ,

  34. 34 geoneypedappy said at 6:52 am on August 29th, 2010:

    Все хорошее когда-нибудь заканчивается. Это высказывание, к сожалению, относится и к эрекции. Эрекция прекращается почти сразу же после эякуляции, потому что эякуляция является сигналом к прекращению выработки циклической АМФ. Но даже прежде, чем ваша эрекция прекратится сама собой из-за эякуляции в половом члене происходит серия химических реакций, направленных на то, чтобы защитить орган от «переутомления».
    http://rusviagra.awardspace.biz/sitemap.html – Купить Дешево Виагру + Бонус – Дженерик Сиалис 2 таблетки

  35. 35 secret_recipes said at 1:05 pm on August 29th, 2010:

    Hello!
    secret recipes ,

  36. 36 restaurant said at 1:06 pm on August 29th, 2010:

    Hello!
    famous restaurant recipes ,

  37. 37 Delivorync said at 9:52 pm on August 29th, 2010:

    Hi!
    Thanks for your site,
    I was exactly looking for something like that!
    I was exactly looking for something like that.
    Good article. Keep it up
    My own online pharmacy =) Now, listen to this very carefully:

    buy tadacip online
    pfizer

  38. 38 rid said at 10:12 pm on August 29th, 2010:

    Hello!
    get rid of belly fat ,

blog comments powered by Disqus