# Question about handling 'new items' per user

**URL:** <https://www.ruby-forum.com/t/question-about-handling-new-items-per-user/143366>\
**Category:** Rails\
**Created:** [July 17, 2008, 6:36pm UTC](https://www.ruby-forum.com/t/question-about-handling-new-items-per-user/143366 "2008-07-17T18:36:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![shenry](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bbce88/32.png) [@shenry](https://www.ruby-forum.com/u/shenry)\
**Post date:** [July 17, 2008, 6:36pm UTC](https://www.ruby-forum.com/t/question-about-handling-new-items-per-user/143366/1 "2008-07-17T18:36:52Z")

</div>

Hi,

I’m building a little app that tracks shipments - each user is  
associated with a role and that role has\_many shipments.

I’d like to add a feature that displays new shipments since the user’s  
last login. Here is my guess at an implementation:

- create a column in the users\_table last\_login that timestamps the  
users last login (duh)
- when the user logs in, the previous last\_login is saved to a  
variable (instance? attr\_accessor?) then overwritten with the current  
login timestamp
- @unseen\_shipments = Shipments.find(:all, :conditions =\> ["created\_at

> ?", last\_login])

All advice and criticism is welcome… thanks!

SH

---

<div class="post-metadata">

**Author:** ![shenry](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bbce88/32.png) [@shenry](https://www.ruby-forum.com/u/shenry)\
**Post date:** [July 18, 2008, 6:22am UTC](https://www.ruby-forum.com/t/question-about-handling-new-items-per-user/143366/2 "2008-07-18T06:22:01Z")

</div>

Any suggestions?
