I have a model called company
with belongsTo
address. I have on backend a serializer with return the link address
.
# frozen_string_literal: true
class CompanySerializer < ActiveModel::Serializer # :nodoc:
...
has_one :address do
link(:related) { company_address_path company_id: object.id }
include_data false
end
end
On load the route companies.edit.address
automatically I GET response of http://ift.tt/2mB0uiR
.
It works, but I need save this when change.
The only way I find to be near of answer is below:
import Route from 'ember-route';
import inject from 'ember-service/inject';
export default Route.extend({
federativeUnits: inject(),
setupController(controller) {
this._super(...arguments);
controller.set('states', this.get('federativeUnits.all'));
},
actions: {
update() {
this.controller.get('model.address.content').save();
}
}
});
The problem is the the given URL: http://ift.tt/2mgphpu
Aucun commentaire:
Enregistrer un commentaire