I am receiving the insert failed: Method not found log message and it probably is the result of what is described in these threads:
However, I'm not seeing how. Let me show the code in hopes that will explain more clearly. I'm using Coffeescript:
if Meteor.isClient @VINs = new Meteor.Collection("vins") scoped_vins = @VINs Template.vins.events = "click .icon-plus-sign": -> console.log "this is #{this}" realVIN = $("#your-vin").val().replace /\D/g, '' console.log "user id is: #{Meteor.userId()} vin is #{parseInt(realVIN)}" VINs.insert number: parseInt(realVIN), owner: Meteor.userId() if Meteor.userId() $("#your-vin").val('') else @VINs = new Meteor.Collection("vins") I'm totally a n00b with Meteor, but what I've gleaned from the above-cited threads is that the collection must be available on the client and the server. Is that not what I have done, or am I developing Coffee-blindness?
Thanks!
Make sure you've also declared your collection on the server as well as the client.
In your code above @VINs = new Meteor.Collection("vins") in both the client and server so what it might be is that you've put your code into the /client directory?
If so this means that the code will only be run on the client, even though you have the else for the if Meteor.isClient block.
To rectify this, copy the line you used into a .coffee file in the /server directory:
@VINs = new Meteor.Collection("vins")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With