• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: SproutCore & ERRest
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SproutCore & ERRest


  • Subject: Re: SproutCore & ERRest
  • From: Miguel Arroz <email@hidden>
  • Date: Wed, 2 Jun 2010 21:30:50 +0100

Hi!

  I'm following the same tutorial. I finally could make it fully work with WO (creating, updating, deleting, etc).

  I did the following changes:

  1) SC expects variables to be camel-cased and not underscored. The SproutCore format created on ERRest was set to underscore variables, so isDone was being converted to is_done, and it would not work (tasks fetched from the server would never be ticked).

  2) As you noticed, "records" should be "content". I submitted a patch to ERRest fixing this problem and the previous.

  3) All URLs have to be adapted, including Update and Delete URLs that have to be built like this:

SC.Request.putUrl('/WO/WebObjects/Todos.woa/-6666/ra/Task/' + store.idFor(storeKey) + '.sc').json()

  4) Apparently, who wrote the tutorial assumed the backends would return an object in response to the PUT request. ERRest will always return an array, so you have to get objectAt(0) on the client side. This is a little hard to fix in ERRest, however, I believe it's not broken at all. The thing is, there appears to be no well defined conventions or standards on this (which is always nice for a protocol...), which means it's really however the app developer wants it to be. So, if you're using ERRest, you want it to be an array. ;)

  I think those were all the issues. I attach my data source file so you can compare. If you adjust the URLs to match yours, it should be just a matter of dropping it in on your client and it should work.

  If you want, please feel free to update Wonder's wiki! ;)

  Yours

Miguel Arroz

Attachment: task.js
Description: JavaScript source

Johnny Miller
Kahalawai Media Corp
http://www.kahalawai.com



Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: SproutCore & ERRest
      • From: Johnny Miller <email@hidden>
  • Prev by Date: Re: Deadlocks in one of our apps
  • Next by Date: Re: SproutCore & ERRest
  • Previous by thread: Re: EOQualifier to qualify NSTimestamp by month
  • Next by thread: Re: SproutCore & ERRest
  • Index(es):
    • Date
    • Thread