Skip to content

Commit d5cec19

Browse files
authored
Fix deleting labels from an article (#528)
Following a81e575, reading and creating labels for articles work as expected - but deleting a label ends up removing the label from the instance _entirely_ (which removes it from all articles) This is due to the `destroy!` action preferring the `url` v. `path` (which, in the case of article labels, `url` returns the [delete label](https://developer.zendesk.com/api-reference/help_center/help-center-api/article_labels/#delete-label) endpoint, while `path` returns the [delete label from article endpoint](https://developer.zendesk.com/api-reference/help_center/help-center-api/article_labels/#delete-label-from-article).
1 parent ce17a2d commit d5cec19

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/zendesk_api/resources.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,12 @@ class Label < DataResource
232232
include Read
233233
include Create
234234
include Destroy
235+
236+
def destroy!
237+
super do |req|
238+
req.path = path
239+
end
240+
end
235241
end
236242
has_many Label
237243
end

0 commit comments

Comments
 (0)