dimanche 3 avril 2016

Rails not receiving Ember parameters from Model

I have a simple Ember 2.4 application. Here's the relevant code

../models/invitation.js

import DS from 'ember-data';

export default DS.Model.extend({
  email: DS.attr('string')
});

../controllers/index.js

import Ember from 'ember';

export default Ember.Controller.extend({

  emailAddress: '',

  actions: {
    saveInvitation() {
      const email = this.get('emailAddress');

      const newInvitation = this.store.createRecord('invitation', {
        email: email,
      });
      newInvitation.save();
    }
  }
});

When I trigger the saveInvitation action, my Rails backend does not receive any parameters. The right action/controller receives the request but the only parameters are {action: "create", controller: "invitations"}.

Am I missing something? Shouldn't the parameters include the invitation with the email?




Aucun commentaire:

Enregistrer un commentaire