Autoform + ValidatedMethods on Meteor 1.3


#1

With the 1.3 version, following also TODO example, I receive a strange error related to the validated-method.

errorClass {error: 404, reason: "Method 'ProjectsMethods.insert' not found", details: undefined, message: "Method 'ProjectsMethods.insert' not found [404]", errorType: "Meteor.Error"}details: undefinederror: 404errorType: "Meteor.Error"message: "Method 'ProjectsMethods.insert' not found [404]"reason: "Method 'ProjectsMethods.insert' not found"stack: (...)get stack: get stack()set stack: set stack()__proto__: Error

The file where the methods are defined is within the /import/api folder and it is correctly referenced in the .js file associated to the .html file where the autoform runs. In the .js file i import both the method file as well as the html file.
validated-Method module cannot go on the server otherwise (of course!) is not found by client
I don’t know so if the issue comes from the new import system but for sure it was not happening before.

Does anyone experiencing the same issue?


#2

Does anyone have any insight into this? Where should we import our methods so that AutoForm can see them?

/edit: this is the best solution from what I can tell: http://stackoverflow.com/questions/37382430/importing-my-methods-so-that-autoform-can-see-them


#3

I’ve solved it by putting the validated methods in the import/api directory.
Nevertheless inside the run function, I’ve added also the if (!this.isSimulation) check in order to perform some of the checks only on the server.
On autoform in case of insert you must add type="method" meteormethod="Validators.insert"