我正在使用Ember.js,Ember-Data和ActiveModelAdapter。我的一个模型有一个双字名OfficialRelation
。当Ember-Data尝试发布此模型的实例时,它会使用网址/official.relations
而不是official_relations
。我不确定这是否是预期的行为。无论哪种方式,我都希望将网址设为official_relations
。
路线如下:
Whistlr.OfficialOrganizationsContributeeNewRoute = Ember.Route.extend
model: ->
@store.createRecord('officialRelation', {official: @modelFor('official'), type: "Official::Relation::Contributee"})
setupController: (controller, model) ->
controller.set('content', model)
deactivate: ->
@get('controller.content').rollback()
renderTemplate: ->
@render "official/organizations/contributee/new",
outlet: "contributeeNew"
into: "official/organizations"
controller: "officialOrganizationsContributeeNew"
更新(模型定义)
Whistlr.OfficialRelation = DS.Model.extend
official: DS.belongsTo 'official',
inverse: 'relations'
startDate: DS.attr()
endDate: DS.attr()
amount: DS.attr()
description: DS.attr()