Maybe, although we try not to put anything into session if we can help
it. Thanks for the idea though.

Any others?

D.

On Sep 8, 1:57 pm, Phlip <[EMAIL PROTECTED]> wrote:
> PeteSalty wrote:
> > we're trying to add a feature where we log a view each time a user
> > looks at a particular item (it's being logged as a database record
> > against the item id).
> > Problem is, if that user refreshes the page we don't want it to
> > register as another view. Users may or may not be logged in when
> > viewing items so we can't log it against the user id.
>
> Stash its id in the session:
>
>   session[:viewed] ||= {}
>   unless session[:viewed][id]
>     add_one_eyeball(id)
>     session[:viewed][id] = true
>   end
>
> There might be a tighter way to do that...
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to