Comparing version 0.7.3 to 0.7.4-1
@@ -24,4 +24,4 @@ exports.definition = function(modelName) { | ||
findAll: function(req, res) { | ||
// Normalize WHERE parameter | ||
var where = applyFilter(req.param("sails_filter"), req.param('where') || req.param('search')); | ||
var where = req.param('where'); | ||
@@ -33,10 +33,12 @@ // If WHERE is a string, try to interpret it as JSON | ||
// If other params are specified, assume they represent attributes to be searched on in the model | ||
// If WHERE has not been specified, but other params ARE specified build the WHERE option using them | ||
var params; | ||
if (!where) { | ||
params = _.extend(req.query || {}, req.params || {}, req.body || {}); | ||
params = applyFilter(req.param("sails_filter"),params); | ||
params = applyFilter(req.param("sails_filter"),params,Model); | ||
// Remove undefined params | ||
// as well as limit, skip, and sort | ||
// (as well as limit, skip, and sort) | ||
// to build a proper where query | ||
params = sails.util.objReject(params, function (param, key) { | ||
@@ -58,4 +60,4 @@ return _.isUndefined(param) || | ||
}; | ||
console.log(options); | ||
// Respond to queries | ||
@@ -75,2 +77,3 @@ var finding = Model.findAll(options); | ||
// Store a new model | ||
@@ -80,3 +83,3 @@ create: function(req, res) { | ||
var params = _.extend(req.query || {}, req.params || {}, req.body || {}); | ||
params = applyFilter(req.param("sails_filter"),params); | ||
params = applyFilter(req.param("sails_filter"),params, Model); | ||
@@ -108,3 +111,3 @@ Model.create(params).done(function(err, model) { | ||
var params = _.extend(req.query || {}, req.params || {}, req.body || {}); | ||
params = applyFilter(req.param("sails_filter"),params); | ||
params = applyFilter(req.param("sails_filter"),params, Model); | ||
@@ -166,3 +169,3 @@ // Ignore id in params | ||
// (e.g. Mast or Backbone.js) | ||
function applyFilter (sails_filter, data) { | ||
function applyFilter (sails_filter, data, Model) { | ||
if (!data || !_.isObject(data)) return data; | ||
@@ -169,0 +172,0 @@ |
@@ -26,3 +26,3 @@ { | ||
], | ||
"version": "0.7.3", | ||
"version": "0.7.4-1", | ||
"description": "API-driven framework for building realtime apps, using MVC conventions (based on Express and Socket.io)", | ||
@@ -55,3 +55,3 @@ "homepage": "http://sailsjs.com", | ||
"dependencies": { | ||
"waterline": "~0.1.6-0", | ||
"waterline": "~0.2.0", | ||
"express": "= 2.5.11", | ||
@@ -74,2 +74,8 @@ "socket.io": "= 0.9.6", | ||
}, | ||
"devDependencies": { | ||
"mocha": "*", | ||
"chai": "*", | ||
"coffee-script": "*", | ||
"request": "*" | ||
}, | ||
"repository": { | ||
@@ -76,0 +82,0 @@ "type": "git", |
@@ -57,3 +57,3 @@ ![image_devInTub@2x.png](http://i.imgur.com/Tj9Nk.png) | ||
exports = HelloController; | ||
module.exports = HelloController; | ||
``` | ||
@@ -60,0 +60,0 @@ |
174774
59
2447
4
+ Addedwaterline@0.2.0(transitive)
- Removedwaterline@0.1.6-0(transitive)
Updatedwaterline@~0.2.0