I am new to meteor and coffee houses. I use the file layout suggested in the Unofficial Meteor FAQ. In the collections of /C.coffee files I have
C = new Meteor.Collection 'C' console.log "C: #{C}"
In the file server /main.coffee I have
C.insert {test: 'test'}
When I launch a meteorite, I see on the console:
C: [object Object] ReferenceError: C is not defined at app/server/main.coffee.js:5:1 at /home/xxx/yyy/.meteor/local/build/server/server.js:298:12
How to make C available in files outside of /C.coffee collections?
Update: adding @ to C fixes the problem at the top level. However, it still does not work:
Meteor.methods test: (statement) -> @C.insert {test: 'test'}
Error with error TypeError: Cannot call method 'insert' of undefined
coffeescript meteor
Jerry
source share