Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
Buggy Meteor App
/* CSS declarations go here */
<template name="tab">
{{#each drinks_menu}}
{{> drink_from_menu}}
<h1>My Tab</h1>
{{#each ordered_drinks}}
{{> drink_from_tab}}
<template name="drink_from_menu">
<div>{{name}}: ${{price}}<input type="button" value="buy one" class="buy_drink"/></div>
<template name="drink_from_tab">
<div>{{name}}: ${{price}}</div>
Tabs = new Meteor.Collection('tabs');
Drinks = new Meteor.Collection('drinks');
if (Meteor.isClient) {
'/': 'home',
'/tabs/:id': function (id) {
Session.set('tabId', id);
return 'tab';
}); = function(){
return Drinks.find({});
}; = function () {
return Tabs.findOne(Session.get('tabId')).ordered_drinks;
'click .buy_drink': function () {
Tabs.update({_id:Session.get('tabId')}, {$push: {ordered_drinks: this}});
if (Meteor.isServer) {
Meteor.startup(function () {
'/tabs/:id.xml': function(id) {
return Tabs.findOne(id).owner;
if (Drinks.find().count() === 0) {
Drinks.insert({name: "Screwdriver", price: "5.00"});
Drinks.insert({name: "Rum and Coke", price: "5.50"});
Drinks.insert({name: "Kilkenny's", price: "8.00"});

I put together a fixed version of this here:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.