# Unsubscribe: Best practices

**URL:** <https://discuss.rubyonrails.org/t/unsubscribe-best-practices/72887>\
**Category:** rubyonrails-talk\
**Created:** [January 10, 2018, 11:24am UTC](https://discuss.rubyonrails.org/t/unsubscribe-best-practices/72887 "2018-01-10T11:24:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ralph\_Shnelvar1](https://avatars.discourse-cdn.com/v4/letter/r/85f322/32.png) [@Ralph\_Shnelvar1](https://discuss.rubyonrails.org/u/Ralph_Shnelvar1)\
**Post date:** [January 10, 2018, 11:24am UTC](https://discuss.rubyonrails.org/t/unsubscribe-best-practices/72887/1 "2018-01-10T11:24:31Z")

</div>

I have a mailing list in a Postgres database and I want to give my users the ability to unsubscribe from mailings.

I wish to send out emails with a link to an RoR website to handle the unsubscribe.

Is there a document anywhere that describes how to do this properly? That is, what the link in the email should look like and what the controller(s), routes.rb, and view(s) should look like?

Do I need to do a (implied) DELETE verb anywhere?

Ralph

---

<div class="post-metadata">

**Author:** ![walterdavis](https://sea2.discourse-cdn.com/rubyonrails/user_avatar/discuss.rubyonrails.org/walterdavis/32/705_2.png) [@walterdavis](https://discuss.rubyonrails.org/u/walterdavis)\
**Post date:** [January 10, 2018, 1:34pm UTC](https://discuss.rubyonrails.org/t/unsubscribe-best-practices/72887/2 "2018-01-10T13:34:54Z")

</div>

You don't (really) want a GET action to result in a DELETE, though, so I would recommend that rather than try to make the link in the e-mail delete the record immediately, take the user to a regular page, where you can construct a POST to DELETE, in the usual Rails manner (method: :delete). That gives a person a chance to reconsider, too, in case they fat-fingered the link in a mobile e-mail client.

Walter

---

<div class="post-metadata">

**Author:** ![Joe\_Guerra](https://avatars.discourse-cdn.com/v4/letter/j/c89c15/32.png) [@Joe\_Guerra](https://discuss.rubyonrails.org/u/Joe_Guerra)\
**Post date:** [January 10, 2018, 8:13pm UTC](https://discuss.rubyonrails.org/t/unsubscribe-best-practices/72887/3 "2018-01-10T20:13:30Z")

</div>

You basically need a boolean field in your mailing list table called subscribe.

you can toggle that with true or false for the user by asking a question and flipping this bit.

As far as sending a link - I already wrote this procedure. It’s quite easy.

> **[GitHub - merlin2049er/signupebook: just a quick example of app that captures...](https://github.com/merlin2049er/signupebook)**
>
> just a quick example of app that captures an email address, then emails an ebook link. - GitHub - merlin2049er/signupebook: just a quick example of app that captures an email address, then emails a...

basically have a controller that asks for the name and email address (capture that) , then send out a mailer with a link to the file you want.

I have my link to a file in the public folder (but the user isn’t aware of that until he get’s the email.)

---

<div class="post-metadata">

**Author:** ![Joe\_Guerra](https://avatars.discourse-cdn.com/v4/letter/j/c89c15/32.png) [@Joe\_Guerra](https://discuss.rubyonrails.org/u/Joe_Guerra)\
**Post date:** [January 10, 2018, 8:36pm UTC](https://discuss.rubyonrails.org/t/unsubscribe-best-practices/72887/4 "2018-01-10T20:36:59Z")

</div>

I think I have to push an update to this code.

I’m missing the deliver after creating the record. I’ll do that tonight.
