Skip to content

Commit

Permalink
correct call of defaul rest api for controllers with models
Browse files Browse the repository at this point in the history
  • Loading branch information
devel-pa committed Dec 17, 2013
1 parent 68523fa commit dea71c7
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/hooks/controllers/controller.create.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = function (sails) {

// Grab model class based on the controller this blueprint comes from
// If no model exists, pretend this blueprint doesn't exist and call next middleware
var Model = sails.config.hooks.orm && sails.models[req.target.controller];
var Model = sails.config.hooks.orm && sails.models[req.target.controller.replace('/','')];
if (!Model) {
return next();
}
Expand Down
2 changes: 1 addition & 1 deletion lib/hooks/controllers/controller.destroy.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module.exports = function (sails) {
// Locate and validate id parameter
// Grab model class based on the controller this blueprint comes from
// If no model exists, move on to the next middleware
var Model = sails.hooks.orm && sails.models[req.target.controller];
var Model = sails.hooks.orm && sails.models[req.target.controller.replace('/','')];
if (!Model) {
return next();
}
Expand Down
2 changes: 1 addition & 1 deletion lib/hooks/controllers/controller.find.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module.exports = function (sails) {

// Grab model class based on the controller this blueprint comes from
// If no model exists, move on to the next middleware
var Model = sails.hooks.orm && sails.models[req.target.controller];
var Model = sails.hooks.orm && sails.models[req.target.controller.replace('/','')];
if (!Model) {
return next();
}
Expand Down
2 changes: 1 addition & 1 deletion lib/hooks/controllers/controller.update.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = function (sails) {

// Grab model class based on the controller this blueprint comes from
// If no model exists, move on to the next middleware
var Model = sails.hooks.orm && sails.models[req.target.controller];
var Model = sails.hooks.orm && sails.models[req.target.controller.replace('/','')];
if (!Model) {
return next();
}
Expand Down

0 comments on commit dea71c7

Please sign in to comment.