yogiben / meteor-autoform-file

Upload and manage files with #autoForm
MIT License
92 stars 101 forks source link

Unable to update... #59

Closed vimes1984 closed 8 years ago

vimes1984 commented 9 years ago

When using a autoform to update a collection like so: {{> quickForm collection="MediaCollection" doc=updateMediasingle id="updateMediaForm" type="update"}}

And defining a doc in a template helper: Template.editmedia.helpers({ updateMediasingle: function() { return MediaCollection.findOne({_id: $stateParams.mediaID}); } }); I'm getting: Exception in template helper: TypeError: collection.findOne is not a function at Object.Template.afFileUpload.helpers.fileUpload /yogiben_autoform-file.js?:285:24)

It fails to load the image on first render but does load it after I hit submit on the update form..

mpowaga commented 9 years ago

Make sure that MediaCollection is defined in global scope. This seems to be a problem.