# Inbox addon for app

**URL:** <https://www.ruby-forum.com/t/inbox-addon-for-app/110833>\
**Category:** Rails\
**Created:** [July 31, 2007, 12:36pm UTC](https://www.ruby-forum.com/t/inbox-addon-for-app/110833 "2007-07-31T12:36:44Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![softf5ajivanet](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/9f8e36/32.png) [@softf5ajivanet](https://www.ruby-forum.com/u/softf5ajivanet)\
**Post date:** [July 31, 2007, 12:36pm UTC](https://www.ruby-forum.com/t/inbox-addon-for-app/110833/1 "2007-07-31T12:36:44Z")

</div>

Hi, i’m trying to write a sort-of inbox feature for my app.

e.g.  
having a ‘inbox’ & ‘sent items’ area for each logged in user so they can  
send and receive messages to people logged into the system.

i’m thinking the data model would be something like…

message  
user\_id  
created\_at  
updated\_at

something like that,

the state (not read, read, sent) would determine what box it should sit  
in, sort of like a blog / list model to connect each message together  
like a line of history.

unsure.

any thoughts?

---

<div class="post-metadata">

**Author:** ![softf5ajivanet](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/9f8e36/32.png) [@softf5ajivanet](https://www.ruby-forum.com/u/softf5ajivanet)\
**Post date:** [July 31, 2007, 12:48pm UTC](https://www.ruby-forum.com/t/inbox-addon-for-app/110833/2 "2007-07-31T12:48:18Z")

</div>

John G. wrote:

> created\_at  
> any thoughts?  
> I seem to vaugely recall someone writing about a plugin doing that kind  
> of thing. Maybe you can save yourself a bit of time browsing the plugin  
> lists at:

[http://agilewebdevelopment.com/plugins](http://agilewebdevelopment.com/plugins)

And maybe me memory is corrupted and you should just go ahead and do it  
yourself. It sounds like a pretty easy task 😉

–  
Cheers,

- Jacob A.

---

<div class="post-metadata">

**Author:** ![softf5ajivanet](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/9f8e36/32.png) [@softf5ajivanet](https://www.ruby-forum.com/u/softf5ajivanet)\
**Post date:** [July 31, 2007, 4:59pm UTC](https://www.ruby-forum.com/t/inbox-addon-for-app/110833/3 "2007-07-31T16:59:57Z")

</div>

On 7/31/07, John G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> user\_id
> 
> any thoughts?

You may want sender/receiver fields too.

–  
Rick O.  
[http://lighthouseapp.com](http://lighthouseapp.com)  
[http://weblog.techno-weenie.net](http://weblog.techno-weenie.net)  
[http://mephistoblog.com](http://mephistoblog.com)

---

<div class="post-metadata">

**Author:** ![softf5ajivanet](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/9f8e36/32.png) [@softf5ajivanet](https://www.ruby-forum.com/u/softf5ajivanet)\
**Post date:** [July 31, 2007, 6:08pm UTC](https://www.ruby-forum.com/t/inbox-addon-for-app/110833/4 "2007-07-31T18:08:18Z")

</div>

Thanks Rick, yep suppose I would, haven’t fully worked out then data  
model for this.

as a sidenote,

how do you write listboxes and checkboxes elements into the ruby forms?

---

<div class="post-metadata">

**Author:** ![softf5ajivanet](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/9f8e36/32.png) [@softf5ajivanet](https://www.ruby-forum.com/u/softf5ajivanet)\
**Post date:** [July 31, 2007, 8:17pm UTC](https://www.ruby-forum.com/t/inbox-addon-for-app/110833/5 "2007-07-31T20:17:27Z")

</div>

I’d probably add an Inbox model that belongs\_to messages with a column  
for the user\_id and read\_state  
Then do a current\_user.inbox.messages for your index find, and use  
group\_by in the view to divide them up by state.  
This way a message can be ‘delivered’ to multiple people with  
different states. A user deleteing a message removes it from his  
inbox. Then periodically purge all orphaned messages… (just thinking  
out loud here)

linoj

On Jul 31, 6:36 am, John G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
