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

Fix error on user-defined restangular fields #826

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Fix error on user-defined restangular fields #826

wants to merge 3 commits into from

Conversation

apuchenkin
Copy link

collection.post and collection.getList is undefined, after renaming restangular fields by:
RestangularProvider.setRestangularFields(renamedFields);

var knownCollectionMethods = _.values(config.restangularFields);
var serv = {};

var allMethod = parent ? config.restangularFields.all : "all";
Copy link
Contributor

Choose a reason for hiding this comment

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

I might be wrong, but shouldn't it be var allMethod = config.restangularFields.all || "all";. I don't really see the point of testing on parent...

for (var prop in collection) {
if (collection.hasOwnProperty(prop) && _.isFunction(collection[prop]) && !_.contains(knownCollectionMethods, prop)) {
serv[prop] = _.bind(collection[prop], collection);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

The indentation has changed here, making it seem that more has been changed than actually has. Fix the indentation to show the actual changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants