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

Only the first part of URL is used for the namespace #50

Open
gkorland opened this issue Jan 29, 2014 · 4 comments
Open

Only the first part of URL is used for the namespace #50

gkorland opened this issue Jan 29, 2014 · 4 comments

Comments

@gkorland
Copy link
Contributor

In my case (and I it's very common when you have complex model) the url looks like this: /users/profiles/categories/{cat_id}

But Backbone.iosync only uses the first part as a namespace:

if (params.url) {
    params.url = _.result(params, 'url');
  } else {
    params.url = _.result(model, 'url') || urlError();
  }

  var cmd = params.url.split('/')
    , namespace = (cmd[0] !== '') ? cmd[0] : cmd[1]; // if leading slash, ignore

Which means all models which have a URL that starts with /users/... loose the rest of the URL.

gkorland added a commit to gkorland/backbone.iobind that referenced this issue Jan 29, 2014
In case the URL is multi leveled use the full URL for namespace.
@mahnunchik
Copy link
Contributor

tests are broken

@gkorland
Copy link
Contributor Author

how do you run the tests?

npm install
make test

Yells

 1) Backbone.iobind ioBind:
     TypeError: Object function ( w ) {
                if ( !w.document ) {
                    throw new Error( "jQuery requires a window with a document" );
                }
                return factory( w );
            } has no method 'Deferred'

@mahnunchik
Copy link
Contributor

Definition of commonjs jquery module was changed in new version. This error is because of this.

I have just updated package.json in this repos with jquery 1.8.3 as dependency. With this fix these tests pass.

npm install
make build
make test

Tests do not pass because the new changes added model id to the destination url.

@gkorland gkorland reopened this Jan 30, 2014
@mahnunchik
Copy link
Contributor

@gkorland Could you please provide tests

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

No branches or pull requests

2 participants