Loading has_many relations automatically

6 views
Skip to first unread message

Turgay Birand

unread,
Jul 12, 2011, 10:01:05 AM7/12/11
to restfulx-...@googlegroups.com
Hello,

I have a class named Firm, which has_many Addresses;

[HasMany]
public var addresses:ModelsCollection;

Is there a way to load the addresses automatically after doing Rx.models.index(Firm)? Currently the addresses property of the returned objects are all null. I know this works fine for belongs_to.

I also tried to use the findAll function as such;

var aux:AuxAIRController = new AuxAIRController();
aux.findAll(Firm, ["active=true"], ["addresses"]);

This doesn't really do anything, when I call Rx.models.index after this nothing changes.

By the way, there is a bug at line 142 of AuxAIRController.as which prevents the conditions from being null (or empty conditions don't work either)

Thanks for any help.

Dima Berastau

unread,
Jul 12, 2011, 11:01:54 AM7/12/11
to restfulx-...@googlegroups.com
Hi Turgay,

There's a few test cases for AuxAIRController here: https://github.com/dima/restfulx_framework/blob/master/tests/src/restfulx/test/cases/AuxAIRControllerTest.as

There's examples there for doing nested HasMany loads using AuxAIRController.

Thanks for the bug report. Looks like you have already fixed it for yourself, just send a pull request and I'll apply your patch.

Regards,
Dima

> --
> You received this message because you are subscribed to the Google Groups "restfulx-framework" group.
> To post to this group, send email to restfulx-...@googlegroups.com.
> To unsubscribe from this group, send email to restfulx-framew...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/restfulx-framework?hl=en.
>

Turgay Birand

unread,
Jul 12, 2011, 11:14:17 AM7/12/11
to restfulx-...@googlegroups.com
Thanks for pointing out the tests, I'll dig into those right away.

I've just sent the pull request.

Reply all
Reply to author
Forward
0 new messages