Skip to content

Instantly share code, notes, and snippets.

@jgdovin
Created March 28, 2015 03:10
Show Gist options
  • Save jgdovin/8d8925c18a41cf072386 to your computer and use it in GitHub Desktop.
Save jgdovin/8d8925c18a41cf072386 to your computer and use it in GitHub Desktop.
if (Meteor.isClient) {
Meteor.subscribe('accounts');
}
// in server/security.js
Accounts.permit(['insert', 'update', 'remove']).apply();
// in server/publications/publications.js
Meteor.publish("accounts", function(){
return Accounts.find({});
});
//in template:
{{> quickForm collection="Accounts" id="insertAccountForm" type="insert"}}
//in collections/accounts.js
Accounts = new Mongo.Collection('accounts');
Accounts.attachSchema(new SimpleSchema({
name: {
type: String,
label: "Name",
max: 200
},
phone: {
type: Number,
label: "Phone #",
optional: true
},
phone2: {
type: Number,
label: "Phone #",
optional: true
},
fax: {
type: Number,
label: "Fax",
optional: true
},
billingAddress: {
type: String,
label: "Billing Address",
optional: true
},
shippingAddress: {
type: String,
label: "Shipping Address",
optional: true
},
email: {
type: String,
optional: true,
label: "Email",
regEx: SimpleSchema.RegEx.Email
}
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment