# Activity feeds for deletions (help on approach)

**URL:** <https://www.ruby-forum.com/t/activity-feeds-for-deletions-help-on-approach/159512>\
**Category:** Rails\
**Created:** [February 5, 2009, 9:09am UTC](https://www.ruby-forum.com/t/activity-feeds-for-deletions-help-on-approach/159512 "2009-02-05T09:09:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![elioncho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ed8c4c/32.png) [@elioncho](https://www.ruby-forum.com/u/elioncho)\
**Post date:** [February 5, 2009, 9:09am UTC](https://www.ruby-forum.com/t/activity-feeds-for-deletions-help-on-approach/159512/1 "2009-02-05T09:09:52Z")

</div>

Hello guys,

I created activity feeds for my project using a polymorphic model  
called feed. The table contains the following columns:

resource\_id  
resource\_type  
user\_id  
project\_id

Everytime I added a record its feed was added via an observer and  
everytime it was deleted the feed was gone too. The problem is that I  
now want to have a feed for deleted records.

Problem: When I delete a record now, the original feed stays unerased  
and when I render the activity feeds I can no longer use the  
resource\_id value to find data to display cause that id it no longer  
exists.

I decided to use two extra columns. One to save a common name that I  
could use on my deleted record feeds. For example if my feed said  
“Roger has been created”, (roger which is the name of the user, was  
found via the resource\_id) now I saved that name to a new column  
called resource\_name. That way I could look into that column to write  
my feed: “Roger has been deleted” once the record gets deleted. The  
second column will be one called action that will let me know if the  
feed was for a “create” or “destroy” action, which will help me on  
displaying the feed message accordingly.

So what are your opinions on this approach. Do you have any ideas to  
optimize it or a whole new better approach?

Thanks for your time,

Elías

P.S. By the way, when a record is deleted I want it to be truly  
deleted. I don’t want an approach where I could add a deleted\_at  
column to keep the record unused but available to help me on  
referencing the resource\_id).

---

<div class="post-metadata">

**Author:** ![elioncho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ed8c4c/32.png) [@elioncho](https://www.ruby-forum.com/u/elioncho)\
**Post date:** [February 5, 2009, 3:49pm UTC](https://www.ruby-forum.com/t/activity-feeds-for-deletions-help-on-approach/159512/2 "2009-02-05T15:49:13Z")

</div>

Any ideas guys or is it ok to handle this approach?

---

<div class="post-metadata">

**Author:** ![elioncho](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/ed8c4c/32.png) [@elioncho](https://www.ruby-forum.com/u/elioncho)\
**Post date:** [March 3, 2009, 6:18pm UTC](https://www.ruby-forum.com/t/activity-feeds-for-deletions-help-on-approach/159512/3 "2009-03-03T18:18:14Z")

</div>

Elias O. wrote:

> Any ideas guys or is it ok to handle this approach?

On a somewhat related note, you might want to check out this plugin:

> **[GitHub - face/activity\_streams: ActivityStreams is a Rails Plug-in providing a...](https://github.com/face/activity_streams/tree/master)**
>
> master
