#9 Cappuccino and Ruby on Rails : the Weblog application (part 2)

In the previous episode I showed you how to build the Cappuccino interface for the example Rails Weblog application.

In this episode, we’re gonna create the links between the front-end and the backend.

You can learn more about the Rails Weblog application by watching this screencast by Ryan Bates (@rbates). The original code of the Rails Weblog application is hosted on Ryan’s Github page, but you’ll find a slightly modified version in the episode source code for your convenience. Thanks to Ryan for letting me embed the code directly in my repository.

Useful links :

The login / password for the Rails app are admin / secret. This can be changed in app/controllers/posts_controller.rb, at line 99.

16 Comments

  1. Nasim says:

    Very nice screencast mate! I am learning a lot from your good work. May I ask a favour though? Could you use Interface Builder to build the GUI so that we can know how to use IB with cappuccino? This would be great.

    Cheers!

  2. Thomas says:

    @Nasim : Thanks for your feedback. I’ll surely record an episode about nib2cib.

  3. Mike says:

    When I try to run the code locally I get:

    ActionController::NotImplemented (Only get and post requests are allowed.):

    Has anyone else seen this problem or arrived at a fix?

  4. Thomas says:

    @Mike : Which version of Rails are you running?

  5. Mike says:

    That specific error was with 2.2.2

    I updated to 2.3.2 and got a similar, but slightly different error:
    ActionController::MethodNotAllowed (Only get and post requests are allowed.):

    Interestingly I see that error from Safari (4), but when I try to run from Firefox I get:
    Connection did fail with error : [Exception... "Access to restricted URI denied" code: "1012" nsresult: "0x805303f4 (NS_ERROR_DOM_BAD_URI)" location: "http://localhost:3000/Frameworks/Objective-J/Objective-J.js Line: 2445"]

    In that case, I don’t see anything in the server log from rails.

  6. Thomas says:

    @mike : can you zip you rails app folder and send it to me by e-mail? thomas /at/ suitmymind /dot/ com

  7. Thomas says:

    @mike : the missing .j files is not an error (read here : http://groups.google.com/group/objectivej/msg/cfbc29e0dbbb3999)

    I cannot reproduce the “ActionController::NotImplemented (Only get and post requests are allowed.):” with the code you sent me … :-/

  8. angel says:

    Hello

    Try http://0.0.0.0:3000 instead of http://localhost:3000.

    Cheers!

  9. Carlos says:

    Thomas,

    I receive the same error as @mike.

    Processing ApplicationController#index (for 127.0.0.1 at 2009-10-04 21:26:00) [OPTIONS]
    ActionController::MethodNotAllowed (Only get and post requests are allowed.):

    I’m running Rails 2.3.4 and the code from the cappuccinocasts-episodes from github.

    The weird part is on FF 3.5.2 generates the correct request but Safari 4.0.3 does not (error seen from Safari 4.0.3) but in FF, nothing is shown in the browser..it’s completely blank.

    I’m running 10.6.1, rails 2.3.4, Safari 4.0.3, FF 3.5.2

    thanks

  10. Carlos says:

    Update.

    I was able to resolve this by using the Frameworks dir from the github repo instead of using the HEAD of cappuccino’s github repo.

    Which version of Cappuccino was used for these examples?

    thanks

  11. Thomas says:

    @Carlos : I don’t know which version of Cappuccino is used. It was the “edge” version at the time I recorded the screencast.

  12. drboolean says:

    Hey Thomas. Love these screencasts! I agree with Nasim on the IB cast.

    Looks like rails is getting OPTIONS as the request method.

    console.log([request HTTPMethod]); // returns GET

    Do you suppose this is a problem with the new implementation of CPURLRequest?

    Any suggestions for things to try from here?

  13. [...] available as a public beta since yesterday). I will assume that you already watched episodes #8 and episode #9, cause in this screencast, I’ll reuse part of the code that was written during those [...]

  14. [...] with 280atlas.com. The screencasts for Cappuccino also worked for me with only a small hitch on the #9 Ruby on Rails [...]

  15. Hi,Fantastic blog post dude! i am just Fed up with using RSS feeds and do you use twitter?so i can follow you there:D.
    PS:Do you thought about putting video to the blog posts to keep the visitors more entertained?I think it works.Sincerely, Millicent Clouser