Question about handling 'new items' per user

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

Any suggestions?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs