Closed chriswilks closed 9 years ago
Hey @chriswilks! It could be useful to check https://github.com/roundscope/ember-couchdb-kit/tree/master/example internals. There is a good example of hasMany
usage in practice. Let me know if that helps you.
When async is true the relations are retrieved via separate requests, so the related items fields are populated, well, asynchronously. So make sure your backend returns a field which is an array of related items ids if you set async: true
.
moved to #116
Thanks for some great work thus far with this toolkit.
I'm trying to implement a simple hasMany relationship setup. Here are my models:
The route/resource definitions:
The job view route:
The jobs/view.hbs Template:
I also have some routes for Jobs Index and an Items Index, as well as the associated templates.
Please excuse my confusing terminology... a 'View' in this case is not a View in an Ember context, but a mechanism for viewing a single item or job.
We get a list of all Jobs on the Index page for Jobs, but when we view a specific Job record the fields for related items are blank. However, if we then navigate to the Items Index page, and then back to view a specific job, the related item field values are then populated.
Is there a way to ensure that related hasMany entities are loaded automatically when we first load a record? Is this something we need to do in our CouchDB design document or on the Ember side?
Thanks
Chris