Q:

In Rails 3, how can I save user search history to the database with no membership/authentication system?

Currently, the site is storing "previously viewed items" via cookies.  
I need to take that a step further and not only store those items in the database, but save the user's most recent search, so that they can retrieve the search later by returning to the site (the cookie can handle this), but also through say a four-letter code and later a QR code.
When you get into writing these non-authenticated users' data to the database, what is the identifier to use as the key to differentiate them?  And would it be ideal to create the actual model record upon visiting the home page, or perhaps after the initial search?

A:

You could save the IP address, other than that, there is really no way to save something specific to a user.
Use the rails request object. You can access the IP with request.remote_ip.
This is the only thing I can think of that is request specific without auth.

