Skip to content

Commit

Permalink
fix: Rename delete() resource method to destroy()
Browse files Browse the repository at this point in the history
  • Loading branch information
Dirk Grappendorf committed Mar 31, 2015
1 parent c330e72 commit 171b280
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ Attributes
new | GET | /users/new
create | POST | /users
update | PUT | /users
delete | DELETE | /users/1
destroy | DELETE | /users/1
member foo | PUT | /users/1/foo

The method names are based on the corresponding controller methods of Ruby on Rails.

* **params**

Expand Down Expand Up @@ -70,7 +72,7 @@ Attributes

Use this URL instead of the default one for "PUT /resources/:id" requests.

* **deleteUrl**
* **destroyUrl**

- *type:* string

Expand Down Expand Up @@ -129,9 +131,9 @@ Resource Object methods
Performs a HTTP PUT on the update URL with the specified resource id and data and returns
the response data.

* **delete(id, successCallback, errorCallback)**
* **destroy(id, successCallback, errorCallback)**

Performs a HTTP DELETE on the delete URL with the specified resource id and returns the response
Performs a HTTP DELETE on the destroy URL with the specified resource id and returns the response
data.

* **memberAction(id, action, successCallback, errorCallback)**
Expand Down
4 changes: 2 additions & 2 deletions src/grapp-rest-resource.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ Polymer 'grapp-rest-resource',
else
error? json

delete: (id, success, error) ->
destroy: (id, success, error) ->
self.$.xhr.request
method: 'DELETE'
url: prepareUrl self.deleteUrl || self.url, self.params, id
url: prepareUrl self.destroyUrl || self.url, self.params, id
headers: self.prepareHeaders()
callback: (data, response) ->
json = (if data.trim() != '' then JSON.parse data else {})
Expand Down
2 changes: 1 addition & 1 deletion src/grapp-rest-resource.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<link href="../core-ajax/core-xhr.html" rel="import">

<polymer-element name="grapp-rest-resource"
attributes="url params resource indexUrl showUrl newUrl createUrl updateUrl deleteUrl memberUrl headers token">
attributes="url params resource indexUrl showUrl newUrl createUrl updateUrl destroyUrl memberUrl headers token">

<template>

Expand Down

0 comments on commit 171b280

Please sign in to comment.