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

Model.destroy request params #428

Closed
wclr opened this issue Jun 12, 2013 · 6 comments
Closed

Model.destroy request params #428

wclr opened this issue Jun 12, 2013 · 6 comments
Milestone

Comments

@wclr
Copy link
Contributor

wclr commented Jun 12, 2013

Why not make possible to make destroy request with other params then just "id"?

destroy: 'DELETE /api/items/{some_other_id_attr}'
@daffl
Copy link
Contributor

daffl commented Jun 12, 2013

The placeholder {} should allow any model attribute. If it doesn't, could you make a quick Fiddle demonstrating what you are looking for?

@wclr
Copy link
Contributor Author

wclr commented Jun 12, 2013

So what does that code mean in models.js?

            // `destroy` does not need data.
            if ( type == 'destroy' ) {
                args.shift();
            }
            // `update` and `destroy` need the `id`.
            if ( type !== 'create' ) {
                args.unshift(getId(self));
            }

In Ajax options generator function data contains only id, so any other params in {} are replaced with false.

@wclr
Copy link
Contributor Author

wclr commented Jun 12, 2013

this code removes all data other than id

        destroy : {
            type : "delete",
            data : function(id){
                var args = {};
                args.id = args[this.id] = id;
                return args;
            }
        },

@wclr
Copy link
Contributor Author

wclr commented Jun 14, 2013

so, will you consider this a bug or feature to add? Besides I don't know how to create fiddle that will show the behaviour. It blocks all ajax requests. But look at the code I supplied it is obvious.

@daffl
Copy link
Contributor

daffl commented Jun 14, 2013

I agree, it should allow all parameters.

@daffl
Copy link
Contributor

daffl commented Oct 14, 2013

Fixed with #492.

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

No branches or pull requests

3 participants