update Example?

0 views
Skip to first unread message

Mike Hostetler

unread,
Mar 31, 2008, 10:53:30 PM3/31/08
to Jester JS
I'm using Jester for creating new objects in my Rails app -- and it's
quite nice. But I can't seem to get an update right. I know the ID
of the object that I want to update, but it seems that the "update"
method isn't found. If I find the object by ID, change some data, and
do an "obj.save()", it seems to send the whole Jester object back and
get "QUERY_STRING is too long".

All that to say -- anyone have an example of updating an existing
object?

Mike Hostetler

unread,
Apr 2, 2008, 11:08:33 PM4/2/08
to Jester JS
okay, let me show you what I have.

I have a Scaffold in Rails and am trying to post changes with the
latest Jester. When i try this:

Jester.Resource.model("Note", {"checkNew":true});
var note = Note.find("first",{id: noteid.value});
note.save();

I see this in my Firebug:
GET http://localhost:3000/notes/new.xml (165ms)prototype.js (line
1222)
GET http://localhost:3000/notes.xml?id=5 (212ms)prototype.js (line
1222)
missing ; before statement
[Break on this error] 0.build(this._attributesFromTree(value))
jester.js (line 395)

any ideas what is happening?

Eric Mill

unread,
Apr 3, 2008, 10:14:42 AM4/3/08
to Jester JS
Does a request to http://localhost:3000/notes.xml?id=5 actually return
a list with just one object? If not, that's your problem. If so,
then there's a bug. Either way, you could also try using the form
Note.find(noteid.value).

Looking at your specific error, and what could have caused the phrase
"0.build()" to execute, it looks like the bug is related to XML
parsing. Could you turn this into a ticket over at
http://code.google.com/p/jester-js/issues/list ?

Thanks,
Eric

On Apr 2, 11:08 pm, Mike Hostetler <hostetl...@gmail.com> wrote:
> okay, let me show you what I have.
>
> I have a Scaffold in Rails and am trying to post changes with the
> latest Jester.  When i try this:
>
>  Jester.Resource.model("Note", {"checkNew":true});
>  var note = Note.find("first",{id: noteid.value});
>  note.save();
>
> I see this in my Firebug:
> GEThttp://localhost:3000/notes/new.xml(165ms)prototype.js (line
> 1222)
> GEThttp://localhost:3000/notes.xml?id=5(212ms)prototype.js (line

Mike Hostetler

unread,
Apr 3, 2008, 10:01:14 PM4/3/08
to Jester JS
On Apr 3, 9:14 am, Eric Mill <kproject...@gmail.com> wrote:
> Does a request tohttp://localhost:3000/notes.xml?id=5actually return
> a list with just one object? If not, that's your problem. If so,
> then there's a bug. Either way, you could also try using the form
> Note.find(noteid.value).
>
No, http://localhost:3000/notes.xml?id=5 returns an array of all
notes. But doing Note.find(id) hasn't work for me either.
> Looking at your specific error, and what could have caused the phrase
> "0.build()" to execute, it looks like the bug is related to XML
> parsing. Could you turn this into a ticket over athttp://code.google.com/p/jester-js/issues/list?
>

Done, and I filled out an issue on my .find error as well.

Mike
Reply all
Reply to author
Forward
0 new messages