Question 1:
If I have a ember-data model called "Company", how do I tell it to hit /businesses
and /businesses/:id
to retrieve records instead? Is there a way to specify the url for a given model? Even better, like BackboneJS, can I compute a URL for the model at runtime?
Questions 2: I have somewhat a unique requirement, my API is organized this way:
/api/v1/company/:company_id/form/:form_id/items/:item_id
Is there a way to handle this with EmberJS? I understand ember has the DS.hasMany('App.Items') kind of relationships, but they seem to hit the /items/:item_id
URL to get the data instead of the full URL.
How do I deal with this problem?
Answering to your first question, when you're creating your store, you can do this:
As for your second question, based on these guides I believe you can a namespace like the following, replacing the ids with your company and form information, but I haven't done this before so I can't tell for sure this would work. Assuming you land in your application knowing these ids, you could technically replace them:
You could also try setting the model
url
.You can read more about this here