Hooray! I have routes:
TravelClient.Router.map(function() { this.resource('tours', function() { this.resource('tour', { path: ':tour_id' }, function(){ this.route('seats'); }); }); });
And the template:
<script type="text/x-handlebars" data-template-name="tour/seats"> {{...}} </script>
Seats are an attribute of the Tour object:
TravelClient.Tour.find(1).get('seats'); 12
And I am expanding the TourSeats route as follows:
TravelClient.TourSeatsRoute = Ember.Route.extend({ model: function(params) { return TravelClient.Tour.find(params.tour_id).get('seats'); } });
Question: how to display tourist places in the template?
UPDATE:
My lights look like this:
TravelClient.Store = DS.Store.extend({ revision: 11, adapter: 'DS.FixtureAdapter' }); TravelClient.Tour = DS.Model.extend({ title: DS.attr('string'), description: DS.attr('string'), seats: DS.attr('number') }); TravelClient.Tour.FIXTURES = [{ id: 1, title: "Brighton, England", description: "Lorem ipsum dolor ... .", seats: 12 },...
And I changed my route to this:
TravelClient.TourSeatsRoute = Ember.Route.extend({ model: function(params) { return TravelClient.Tour.find(params.tour_id); } });
And in the template:
<script type="text/x-handlebars" data-template-name="tour/seats"> {{tour.seats}} </script>
UPDATE 2:
<script type="text/x-handlebars" data-template-name="tour/seats"> {{controller.model.seats}} </script>
and it returns undefind. After some debugging that I founded, there is no id in params and params is empty, which is why I canβt get the model I need in the TourSeatsRoute function.