mcknightg / flutterbum

Flutterbum Project Manager
http://www.flutterbum.com
MIT License
67 stars 23 forks source link

Error invoking Method 'saveProject': Internal server error [500] #27

Closed vblackburn closed 9 years ago

vblackburn commented 9 years ago

This error happen when I attempt to enter a new project. How can I correct this to allow me to add new projects?

Here is my saveProject method;

'saveProject':function(project){
    check(project.name,String);
    project.userId = Meteor.userId();
    project.dateentered = new Date();
    project.lastupdate = new Date();
    if(!project.datedue){
      project.datedue = new Date();
    }
    if(!project.customer){
      project.customer = Customers.findOne({})._id;
    }
    project.invited = [];
    return Projects.insert(project);
  }

Here is the template that calls it;

Template.dashboard.events({
  'keyup input[type=text]': function(event,tmpl) {
    if(event.which === 27 || event.which === 13){
      event.preventDefault();
      var project = {};
      project.name = tmpl.find('#projectNameEnter').value;
      Meteor.call('saveProject',project);
    }
  },
});
mcknightg commented 9 years ago

Have you tried adding a customer ? I believe this will error if there are no customers.

vblackburn commented 9 years ago

Thanks this worked, really appreciate the help