Nested Jester Classes Failing

0 views
Skip to first unread message

jfw

unread,
Feb 3, 2008, 9:09:40 PM2/3/08
to Jester JS
I have receently encountered a problem involving nested classes using
Jester. The situation is as follows:

I have two ActiveRecord classes, category and subcategory with
category having many subcategories.

I have the following in my Category controller
opt = {:include => :subcategories }
format.json { render :text => @category.to_json(opt)

My javascript client code is:
var xx = Category.find(42)

Now what happens is that all the data returns to the client but
category.subcategories is populated with an array of Objects (contains
the correct data) when I would have expected it to be populated with
an array of Subcategory. This has subsequent problems in calling
save() ext on subcategory. I am able to correctly populate
subcategories with further calls to subcategory.find() but this
requires additional calls which I would prefer not to do.

The json (and xml when I tried that) appears to be well formed and the
use of a global Category({checkNow: true}) does not assist in
identifying the contents of category.subcategories.

Is this:
1.An error on my part
2. A limitation of Jester
3. A bug in Jester

Any clarification and assistance would be much appreciated.

Eric Mill

unread,
Feb 22, 2008, 3:24:42 PM2/22/08
to Jester JS
Thanks jfw, I added this as an issue to the tracker.

http://code.google.com/p/jester-js/issues/detail?id=4

-- Eric
Reply all
Reply to author
Forward
0 new messages