无法使autoform 6.0填充现有数据

时间:2017-03-05 23:32:25

标签: meteor meteor-blaze meteor-autoform simple-schema

我已经更新到简单架构npm并安装了autoform 6.0但是我似乎无法成功生成集合表单。我收到此错误Exception in template helper: TypeError: Cannot read property 'mergedSchema' of undefined并且我不知道它是指什么,因为这是一个新构建,所以它不应该引用任何旧的autoform或简单架构包。

路径:imports/ui/pages/candidate-registration/contact-information/contact-information.html

<template name="App_contactInformation">
  {{#with profile}}
    {{firstName}}
      {{> quickForm collection=Profile id="updateProfile" type="update"}}
    {{/with}}
  {{/if}}
</template>

路径:imports/ui/pages/candidate-registration/contact-information/contact-information.js

import { Profile } from '/imports/api/profile/profile.js';
import './contact-information.html';

Template.App_contactInformation.onCreated(function () {
  this.autorun(() => {
    this.subscribe('private.profile');
  });
});

Template.App_contactInformation.helpers({
  profile() {
    var user = Profile.findOne({userId: Meteor.userId()});
    return user;
    }
});

路径:imports/api/profile/server/publications.js

// All profile-related publications

import { Meteor } from 'meteor/meteor';
import { Profile } from '../profile.js';

Meteor.publish('private.profile', function() {
  if (!this.userId) {
    return this.ready();
  }
  return Profile.find({"userId": this.userId});
});

1 个答案:

答案 0 :(得分:1)

确保您还在使用aldeed:collection2-coreattached your schema to your collection。例如......

Books.attachSchema(Schemas.Book);