0
我在我的應用程序(repo)中獲取預訂屬於某個用戶,我還在請求中包含出租和出租。現在,租賃(屬於預訂)有許多租賃評級,租賃評級屬於用戶。在模板中,我有一個接受預訂和rentRating作爲參數的組件。如何獲得屬於預訂和當前用戶的評分?獲取記錄和嵌套關係
預訂路線:
import Ember from 'ember';
import AuthenticatedRouteMixin from 'ember-simple-auth/mixins/authenticated-route-mixin';
export default Ember.Route.extend(AuthenticatedRouteMixin, {
sessionAccount: Ember.inject.service(),
model() {
const currentUser = this.get('sessionAccount.currentUser');
return this.get('store').query('booking', {
filter: {
'user_id': currentUser.id
},
include: 'rental,rental.rental-ratings'
});
}
});
預訂模板:實現這個
<h1>Your bookings</h1>
{{#each model as |booking|}}
{{booking-card booking=booking rating="??? what goes here???"}}
{{/each}}