This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for user, key in users | |
users[key].prop1 = [ user.id ] | |
users[key].prop2 = [ user.id ] | |
users[key].prop3 = [ user.id ] | |
users[key].prop4 = [ user.id ] | |
#update the data | |
console.log users | |
#shows that only the prop3 is getting updated. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Returns just the referring view. This can be used in the res.redirect or res.view. | |
var referrer = req.header('Referer').replace(req.protocol + "://" + req.host + ":" + req.port + '/', ''); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
return res.view(referringView, {result: false, errors: error_object}); | |
//I'm trying to get the errors in the view via: | |
//<% sails.log(errors); %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Source: https://github.com/balderdashy/sails/issues/27 | |
var UUIDGenerator = require('node-uuid'); | |
var DirectoryController = { | |
// uploads a file to a directory | |
upload: function(req, res) { | |
// Parse form data from server | |
var parsedFormData = JSON.parse(req.param('data')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* CampaignController | |
* | |
* @description :: Server-side logic for managing campaigns | |
* @help :: See http://links.sailsjs.org/docs/controllers | |
*/ | |
module.exports = { | |
fileExtension: function(fileName) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Location: /test/helpers/appHelper.js | |
* | |
* @description :: Provides 'lift' and 'lower' methods to set up | |
* and tear down a Sails instance (for use in tests) | |
*/ | |
var Sails = require('sails'), | |
should = require('should'), | |
async = require('async'), | |
lifted = false, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
/* | |
* Location: /test/bootstrap.test.js | |
* | |
* @description :: This file is run before all other tests. | |
*/ | |
var should = require('chai').should(), | |
appHelper = require('./helpers/appHelper'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
error: The bootstrap function threw an error after its callback was called :: Error: done() called multiple times | |
at Hook.Runnable (/Users/testing/Sites/node_modules/mocha/lib/runnable.js:48:17) | |
at new Hook (/Users/testing/Sites/node_modules/mocha/lib/hook.js:22:12) | |
at Suite.beforeAll (/Users/testing/Sites/node_modules/mocha/lib/suite.js:170:14) | |
at context.before (/Users/testing/Sites/node_modules/mocha/lib/interfaces/bdd.js:37:17) | |
at Object.<anonymous> (/Users/testing/Sites/test/bootstrap.test.js:11:1) | |
at Module._compile (module.js:456:26) | |
at Module._extensions..js (module.js:474:10) | |
at Object.Module._extensions..js (/Users/testing/Sites/node_modules/istanbul/lib/hook.js:102:13) | |
at Module.load (module.js:356:32) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sails = require('sails'), | |
sinon = require('sinon'), | |
assert = require('assert'), | |
request = require('supertest'), | |
appHelper = require('../../helpers/appHelper'), | |
agent = request.agent('http://localhost:1337'); | |
before(function(done){ | |
appHelper.lift(done); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
error: Sending 500 ("Server Error") response: | |
Error (E_VALIDATION) :: 1 attribute is invalid | |
at WLValidationError.WLError (/usr/local/lib/node_modules/sails/node_modules/waterline/lib/waterline/error/WLError.js:33:18) | |
at new WLValidationError (/usr/local/lib/node_modules/sails/node_modules/waterline/lib/waterline/error/WLValidationError.js:20:28) | |
at /usr/local/lib/node_modules/sails/node_modules/waterline/lib/waterline/query/validate.js:45:43 | |
at allValidationsChecked (/usr/local/lib/node_modules/sails/node_modules/waterline/lib/waterline/core/validations.js:195:5) | |
at done (/usr/local/lib/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:135:19) | |
at /usr/local/lib/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:32:16 | |
at validate (/usr/local/lib/node_modules/sails/node_modules/waterline/lib/waterline/core/validations.js:135:49) | |
at /usr/local/lib/node_modules/sails/node_modules/waterline/node_modules/async/lib/async.js:125:13 |
OlderNewer