Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query Support for Fetch #4

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions lib/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Manager.manages = function(model) {
return false;
}

return Manager._managed.indexOf(model) !== -1
return Manager._managed.indexOf(model) !== -1;
};

Manager._managed = [];
Expand Down Expand Up @@ -111,7 +111,7 @@ Manager.prototype.debug = function(debug) {

return arguments[0];
});
};
}
};

if (typeof debug === 'undefined') {
Expand All @@ -131,9 +131,9 @@ Manager.prototype.debug = function(debug) {
return this;
};

Manager.prototype.fetch = function(name, properties, related) {
Manager.prototype.fetch = function(name, properties, related, query) {
var model = this.forge(name, properties);

if (query) { model.query(query); }
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be sexier? e.g.

// <~~ new line
if (query) {
  model.query(query);
}

return model.fetch({
withRelated: related,
});
Expand Down Expand Up @@ -276,7 +276,7 @@ Manager.prototype.saveModel = function(model, properties) {
console.error(error.stack);
throw error;
});
}
};

Manager.prototype.set = function(model, properties) {
if (this.isModel(model)) {
Expand Down