I am currently working on implementing a search functionality within a nested route that shares a model.
Below is an example of my code:
The "Products" and "Search" functionalities return a JSON response.
Router
Market.Router.map ->
@resource 'products'
@resource 'search', { path: "products/search" }
@resource 'product', { path: "products/:product_id" }
The API URL for the rest adapter that I'm trying to reach is as follows:
"rope"
I have defined an action inside a header menu controller for handling the search functionality.
How can I retrieve records within a nested route?
Market.HeaderMenuController = Ember.ArrayController.extend({
searchText: null,
actions: {
searchResults: function(){
this.store.find('product', 'search?search_terms='+this.searchText);
this.store.find('search', { "search_terms":this.searchText });
}
}
});
However, I am encountering the following errors:
Error: Assertion Failed: You must include an
id
for Market.Product in an object passed topush
Uncaught Error: Assertion Failed: Error: Assertion Failed: You must include an
id
for Market.Product in an object passed topush