# Delete command both with id and delete all

**URL:** <https://discourse.rom-rb.org/t/delete-command-both-with-id-and-delete-all/180>\
**Category:** Issues\
**Created:** [July 31, 2017, 7:37am UTC](https://discourse.rom-rb.org/t/delete-command-both-with-id-and-delete-all/180 "2017-07-31T07:37:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![opan](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.rom-rb.org/opan/32/105_2.png) [@opan](https://discourse.rom-rb.org/u/opan)\
**Post date:** [July 31, 2017, 7:37am UTC](https://discourse.rom-rb.org/t/delete-command-both-with-id-and-delete-all/180/1 "2017-07-31T07:37:54Z")

</div>

Let’s say I have repository like this

```auto
require 'rom-repository.'

class UserRepo < ROM::Repository[:users]
  commands :create, update: :by_pk, delete: :by_pk
end

```

As you can see, now I can only do `delete` action only if I provide some `ID`. Is there a way to make this repository also have a capability to do `delete all` action? I’ve already tried to pass `delete` command, to `commands` method like this:

```auto
require 'rom-repository.'

class UserRepo < ROM::Repository[:users]
  commands :create, :delete, update: :by_pk, delete: :by_pk
end

```

But this still doesn’t work.

Thanks in advance  
Opan Mustopah

---

<div class="post-metadata">

**Author:** ![solnic](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.rom-rb.org/solnic/32/279_2.png) [@solnic](https://discourse.rom-rb.org/u/solnic)\
**Post date:** [July 31, 2017, 1:37pm UTC](https://discourse.rom-rb.org/t/delete-command-both-with-id-and-delete-all/180/2 "2017-07-31T13:37:56Z")

</div>

You can just do `users.delete`. Command macros in repos is just a convenience so that people can have common CUD methods available automatically.

---

<div class="post-metadata">

**Author:** ![opan](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.rom-rb.org/opan/32/105_2.png) [@opan](https://discourse.rom-rb.org/u/opan)\
**Post date:** [August 1, 2017, 3:53am UTC](https://discourse.rom-rb.org/t/delete-command-both-with-id-and-delete-all/180/3 "2017-08-01T03:53:03Z")

</div>

Ah yes, it’s working now. I swear I try similar to this, but it didn’t work yesterday. Thank you so much.
